REGEXP – Regular expresion parser
Block SymbolLicensing group: ADVANCED
Function Description
This block implements a subset of Perl or C# or Unix command grep regular expression
syntax.
Supported syntax is :
- (?i) …Must be at the beginning of the regex. Makes match case-insensitive
- ^ …Match beginning of a buffer
- $ …Match end of a buffer
- () …Grouping and substring capturing
- \s …Match whitespace
- \S …Match non-whitespace
- \d …Match decimal digit
- \n …Match new line character
- \r …Match line feed character
- \f …Match form feed character
- \v …Match vertical tab character
- \t …Match horizontal tab character
- \b …Match backspace character
- + …Match one or more times (greedy)
- +? …Match one or more times (non-greedy)
- * …Match zero or more times (greedy)
- *? …Match zero or more times (non-greedy)
- ? …Match zero or once (non-greedy)
- x|y …Match x or y (alternation operator)
- \meta …Match one of the meta characters: ^$().[ ]*+?|\
- \xHH …Match byte with hex value 0xHH, e.g. \x4a
- [...] …Match any character from set. Ranges like [a-z] are supported.
- [^...]…Match any character except the ones in set. Ranges like [a-z] are supported.
Examples
- [0-9]+ …Find first integer in input string (and put it into cap output)
- [-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?…Find first real number in input string (and put it into cap output)
- ^\s*(.*?)\s*$ …Put trimmed input string into cap1 output
- num\s*:\s*([0-9]*\.[0-9]*) …Expect input string in JSON format; find integer parameter num, and put its value into cap1
Inputs
text | String to parse | String |
RUN | Enable execution | Bool |
Parameters
expr | Regular expresion pattern | String |
nmax | Allocated size of string 0 65534 | Long (I32) |
bufmax | Parser internal buffer size (0 = autodetect) 0 10000000 | Long (I32) |
Outputs
MATCH | Pattern match flag | Bool |
cap | Whole matching string | String |
cap1 | Captured string (string matched to 1st bracket) | String |
cap2 | Captured string (string matched to 2nd bracket) | String |
cap3 | Captured string (string matched to 3rd bracket) | String |
cap4 | Captured string (string matched to 4th bracket) | String |
cap5 | Captured string (string matched to 5th bracket) | String |
cap6 | Captured string (string matched to 6th bracket) | String |
cap7 | Captured string (string matched to 7th bracket) | String |
cap8 | Captured string (string matched to 8th bracket) | String |
[Previous] [Back to top] [Up] [Next]
2023 © REX Controls s.r.o., www.rexygen.com