GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SimpleStateMachine/SimpleStateMachine.StructuralSearch

BranchesTags
Open more actions menu

Latest commit

 

History

215 Commits
215 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Packages.props
Directory.Packages.props
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SimpleStateMachine.StructuralSearch.sln
SimpleStateMachine.StructuralSearch.sln
 
 
global.json
global.json
 
 

Repository files navigation

NuGet Pre Release NuGet Downloads

SimpleStateMachine.StructuralSearch

StructuralSearch - An easy-to-use library for structural search and replace in text in any programming language.

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Why SimpleStateMachine?

Forget about regular expressions and *enjoy searching

  1. Describe search pattern🔎
// Just text and placeholders
var template = StructuralSearch.ParseFindTemplate("void $methodName$($params$)")
  1. Find it in any text📄
// All the matches are already here
var results = template.ParseString("void MyMethodName(int value1, double value2)"
  1. Enjoy the search results📑
// The found text part
parseResult.Match.Value // void MyMethodName(int value1, double value2)

// The exact coordinates of the match
parseResult.Match.Column // Start 1, End 45
parseResult.Match.Line // Start 1, End 1
parseResult.Match.Offset // Start 0, End 44
    
// Placeholders
parseResult.Placeholders // { "methodName" : "MyMethodName" }, { "params": "int value1, double value2" }
    
// The exact coordinates of each placeceholdder
parseResult.Placeholders[0].Column // Start 6, End 18
parseResult.Placeholders[0].Line // Start 1, End 1
parseResult.Placeholders[0].Offset // Start 5, End 17

Grammar

logic_expr =
    binary_operation
  | not_operation
  | string_comparison_operation
  | type_check_operation
  | match_operation
  | in_operation
  | '(' logic_expr ')'

binary_operation = logic_expr ('And' | 'Or' | 'NAND' | 'NOR' | 'XOR' | 'XNOR') logic_expr
string_comparison_operation = string_expr ('Equals' | 'Contains' | 'StartsWith' | 'EndsWith') string_expr
not_operation = 'Not' logic_expr
type_check_operation = string_expr 'Is' ('Var' | 'Int' | 'Double' | 'DateTime' | 'Guid')
match_operation = string_expr 'Match' '"' <regex> '"'
in_operation = string_expr 'In' [ '(' ] string_expr { ',' string_expr } [ ')' ]

string_expr =
    grouped_string
  | property_access
  | atomic_token

grouped_string =
    '(' string_expr ')'
  | '{' string_expr '}'
  | '[' string_expr ']'

property_access =
    placeholder '.' (
        'Length'
      | complex_property
      | input_property [ chainable_string ]
    )
  | placeholder [ chainable_string ]

chainable_string = { '.' ('Trim' | 'TrimEnd' | 'TrimStart' | 'ToUpper' | 'ToLower') }

input_property = 'Input.' identifier
complex_property = ('Offset' | 'Line' | 'Column') '.' ('Start' | 'End')

atomic_token = placeholder | string_literal | whitespace | comment
placeholder = '$' identifier '$'
string_literal = <escaped string>
whitespace = (' ' | '\n' | '\r')+
comment = <single or multiline comment>

Getting Started📂

Install from Nuget:

 Install-Package SimpleStateMachine.StructuralSearch

Documentation📄

Documentation here: wiki

FAQ❔

If you think you have found a bug, create a github issue.

But if you just have questions about how to use:

  • Telegram channel

License📑

Copyright (c) SimpleStateMachine

Licensed under the MIT license.

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.