Regular Expression Operators:
^ Matches Beginning of Record, as First Character of Expression
$ Matches End of Record as Last Character of Expression
\c Matches Following:
\a == Bell (Alert) \x007
\b == Backspace \x008
\f == Formfeed \x00c
\n == Newline \x00a
\r == Carriage Return \x00d
\s == Space \x020
\t == Horizontal Tab \x009
\v == Vertical Tab \x00b
\c == c [ \\ == \ ]
\ooo == Character Represented by Octal Value ooo
1 to 3 Octal Digits Acceptable
\xhhh == Character Represented by Hexadecimal Value hhh
1 to 3 Hexadecimal Digits Acceptable
. Matches Any ASCII Character, \x001 to \x0ff
* - Closure, Zero or More Matches
+ - Positive Closure, One or More matches
? - Zero or One matches
r(s)t Embedded Regular Expression s, Strings Matching s are TAGGED
r|s|t '|' == Logical 'or' Operator. Regular Expression r or s or t
[abc0-9] Character List - Match Any Character in List
[!abc0-9] Negated Character List - Match Any Character Not in List
[^abc0-9] Negated Character List - Match Any Character Not in List
[#abc0-9] Matched Character List - For Second Match Character Must
Match in Corresponding Position
[:alpha:] Character Class, Locale dependent string for use in Character
List. Only recognized in a character list. The following
character classes have been defined by POSIX and are available
under QTGrep:
[:alpha:] -- Alphabetic characters
[:alnum:] -- AlphaNumeric characters
[:blank:] -- blank space and tab character
[:cntrl:] -- control characters
[:digit:] -- numeric digits
[:graph:] -- printable and visible characters
[:lower:] -- lower-case alphabetic characters
[:upper:] -- upper-case alphabetic characters
[:print:] -- printable characters
[:punct:] -- punctuation characters
[:space:] -- white space characters
[:xdigit:] -- hexdecimal numeric characters
Look-Ahead Operator
@ - Look-Ahead, r@t, matches Regular Expression 'r' only when r is followed
by Regular Expression 't'. Regular Expression t not contained in final
match. Symbol loses special meaning when contained within parenthesis,
'()', or character class, '[]'.
Repeat Operator
r{n1,n2} - At Least n1 and Up to n2 Repetitions of 'r'
n1, n2 integers with 0 ó n1 ó n2
r{2,6} ==> rrr?r?r?r?
Forms of the repeat operator are:
r{n1,n2} == At Least n1 and Up to n2 Repetitions of 'r', 0 <= n1 <= n2
r{n1} == n1 Repetitions of r, 1 <= n1. Equivalent to: r{n1,n1}
r{n1,} == At least n1 Repetitions of r. Equivalent to: r{n1}r*
r{,n2} == At most n2 Repetitions of r. Equivalent to: r{0,n2}
Regular Expressions grouped by (), [], or names, "{ne}", are repeated as
a group. (Note the Treatment of Named Expressions and Quoted Expressions as
illustrated below.) Optional groups of such expressions are enclosed in
parenthesis to ensure that the Regular Expression operator '?' operates
on the repeated expression as a whole and not just the last character.)
(e1|e2){2,6} ==> (e1|e2)(e1|e2)(e1|e2)?(e1|e2)?(e1|e2)?(e1|e2)?
[a-p]{2,6} ==> [a-p][a-p][a-p]?[a-p]?[a-p]?[a-p]?
[[:alpha:]]{2,4} ==> [[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?
{ne}{2,6} ==> {ne}{ne}({ne})?({ne})?({ne})?({ne})?
"qs"{2,6} ==> "qsqs(qs)?(qs)?(qs)?(qs)?"
Note: For Named Expressions, only defined names are repeated as a group.
If the 'name' has not been defined, then only the ending bracket is
repeated. Thus, if 'ne' is an undefined name:
{ne}{2,6} ==> {ne}}}?}?}?}?
Named Expressions
{named_expr} - Named Expression
In all Regular Expression(s) or Keyword(s), "{name}" is replaced by its
value as defined in the search pattern input file. See '-?#' option help for
defining Named Expressions
© Terry D. Boldt 1997-2005
All Rights Reserved
Last Updated: Feb. 03, 2005