Regular Expressions

Regular Expressions 101 online program for RE operations .

### Initial Function

For each character item of the subject text, starting from the last listed output group at time of the step. Compare each output option of processing the script, to the item with the whole following string. And add the Matching group to the output list.

## Assets

 `[_assets_]`  : a character, 1 of \_assets\_ . not 1 of \_assets\_ --  `[^_assets_]`  .

* \_asset\_ =
	+ `_char_`  : special characters and escapes are not parsed ;
	+ or  `_char_-_char_`  = 1 of characters in the range . the order is :  `0-Z`  . some chars, including ``^_[]\` and not including `~1!@#$%&*()-=+{};:'"|,<.>/?` . and then  `a-z`  ; ; ;
* Example:  `[-_0-Za-z]`  matches  `_test-test` ; ;

 `(_script_)`  = set start and end of the function/operation/{sub-script}, and set it as a Capture Group  .

 `|`  = or .

 `.`  = any character, except newline . any character =  `(.|\n)`  .

 `\s`  = space type character (Space, Tab, .., not Newline) ; not space type character =  `\S`  .

 `{_number_,_number1_}`  = repeat the last, \_number\_ to \_number1\_ much times . 0 to any --  `*`  . 1 to any --  `+`  . certain to any --  `{_number_,}`  . 0 to 1 -- `?`  .

 `_repeat_type_commandOrFunction_?`  = add to the output only minimum times Matching . some named "non-greedy" .

 `^`  = start of the subject string . a start of file, each line or other . the start of input =  `(?<!.|\n)^`  .

 `$`  = end of the subject string . an end of file, each line or other . the end of input =  `$(?!.|\n)`  .

### Insert to check

These commands don't change which position is being processed . So to skip content, you need to output it in a Capture Group which will be ignored .

 `(?=_script_)`  = insert to check, but don't add to the output . to check for not presence --  `(?!_script_)`  . (prevents adding the Matching group)

 `(?<=_script_)`  = insert to check, with this location next to the end of \_script\_, but don't add to the output . to check for not presence --  `(?<!_script_)`  . can be not present in the system .

* Its needed to : find the start of input . or specify the start of step's subject text, to partially avoid the single-return limitation of Capture Groups ;.
* But, [1=] it doesn't accept any Quantifiers (`*` and etc), so can't be used to perform variable amount of operations on step's subject text . For example as : `(?<=start(.|\n)+?)(.)*\n` to output as `$2` , each line after "start" .

### Variables

 `$<<number_1>>`  = in Substitution/Replace, insert the result from [number\_1]-th Capture Group  .

* It can't return multiple outputs from 1 Matching group ( `$2` after `((.*)\n)*` , will return content of the line before the last newLine character ) . This, together with [1], largely limits what a single RE script can be used for .

See also Implementations with Recursion/Recursive output .

### Escaping/Encoding

 `\<<controlSymbol>>`  = escape the controlSymbol .

* `[ \$ , \^ , \* , \( , \) , \- , \+ , \[ , \{ , \] , \} , \\ , \| , \. , \/ , \? ]`

 `\t`  = tab character .

 `\r\n`  = newline (Carriage Return (CR) and Line Feed (LF)) . sometimes, programs accept only  `\n` , with the meaning of any or active newline character, for example VSCode .

 `\f`  = newpage (Form Feed);

## Presets

 `(\[(.|\n)*\]|#(?!\#)[A-z0-9_]+)`  == will output:

* $1 -- a line tag, highest level of `[<<text>>]`, or a #<<name>> (without "-" . because sometimes Space -s is blocked, so replaced with it) . it supports 1 level of "<<" ">>", 1 -- because of the language limitations .

 `(\[(<<[^<>]*>>|[^\[\]]*)\]|#(?!#)(<<[^<>]*>>|[A-z0-9_]+))`  == will output:

* $1 -- a high-compatible file tag, lowest level of `[<<anything without: "[" or "]">>]`, or a #<<name>> (without "-" . because sometimes Space -s is blocked, so replaced with it) . it supports 1 level of "<<" ">>", 1 -- because of the language limitations .

## See also

* At Wikipedia .
* Microsoft version, library intended for C#, in .NET, Quick Reference .

1. ↑ 1.0 1.1 https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-regular-expressions