REGEX Regular Expressions
REFERENCE
Searches and replacements can be performed using Regular Expressions
or REGEX.
Supported metacharacters:
. dot matching any character (except CR or LF)
? question mark previous zero or one time
+ plus sign previous one or more times
* asterisk previous zero or more times
| alternation (OR) match either expression
[ ] character class any character listed
[^ ] negated character class any character not listed
[ - ] character range define inclusive range of characters
^ caret matches position at the start of a line
$ dollar matches position at the end of the line
( ) parentheses limits scope for alternation and
provides grouping for quantifiers
?? question mark previous zero or one time - lazy
+? plus sign previous one or more times - lazy
*? asterisk previous zero or more times - lazy
A lazy operation is satisfied with the shortest match for the quantified
portion of the expression. Normally the Regex engine will continue to
search for a better (longer) match. That is a slower process and not always
necessary.
Escaping
The backslash '\' character is used to escape a number of characters that
otherwise have REGEX function. This also allows you to use non-printable
characters such as tabs, backspaces, carriage returns, etc. There are
macros defined that each expand into a set of characters which can be
convenient.
escaped non-printable:
\a 0x07 BEL (bell)
\b 0x08 BS (backspace)
\t 0x09 TAB (tab)
\n 0x0A LF (line feed)
\v 0x0B VT (vertical tab)
\f 0x0C FF (form feed)
\r 0x0D CR (carriage return)
\e 0x1B ESC (escape)
hexadecimal entry:
\xHH where HH represents two hexadecimal digits
meta characters (macros):
\w [a-zA-Z0-9] word characters
\W [^a-zA-Z0-9] not word characters
\d [0-9] decimal digits
\D [^0-9] not decimal digits
\s [ \f\n\r\t\v] match whitespace
\S [^ \f\n\r\t\v] not whitespace
NOTES
When including a REGEX on the command line or in a string you will need to
again escape the escape character. So to include a tab the escape sequence
would be "\\t".*
SEE ALSO
HELP Topics:
EGREP,
GREP,
REG,
HIST
[/flash/manpages/reference.hlp:523]