Next: Appendix: GATTable
Up: Appendix: Regular Expressions
Previous: Regular Expressions in Formal
  Contents
In this syntax, most characters are treated as literals - they match only themselves ( matches
, matches , etc). The exceptions are called metacharacters:
. Matches any single character
[ ] Matches a single character that is contained within the brackets - matches
, , or . matches any lowercase letter.
[^] Matches a single character that is not contained within the brackets -
matches any single character that isn't a lowercase letter
^ Matches the start of the line
$ Matches the end of the line
( ) Mark a part of the expression. What the enclosed expression matched to can be
recalled by \n where is a digit from 1 to 9.
\n Where is a digit from 1 to 9; matches to the exact string what the expression enclosed
in the th left parenthesis and its pairing right parenthesis has been matched to. This construct is
theoretically irregular and has not adopted in the extended regular expression syntax.
* A single character expression followed by matches to zero or more iteration of the
expression. For example, matches to , , , , , and so on. A ,
where is a digit from 1 to 9, matches to zero or more iterations of the exact string that the
expression enclosed in the th left parenthesis and its pairing right parenthesis has been matched
to. For example,
matches to and but not . An
expression enclosed in and followed by is deemed to be invalid. In some
cases (e.g. /usr/bin/xpg4/grep of SunOS 5.8), it matches to zero or more iteration of the same
string which the enclose expression matches to. In other some cases (e.g. /usr/bin/grep of SunOS 5.8),
it matches to what the enclose expression matches to, followed by a literal .
{x,y} Match the last ``block'' at least and not more than times. - matches
, or .
+ Match the last ``block'' one or more times - matches , , and so on
? Match the last ``block'' zero or more times - matches or
| The choice (or set union) operator: match either the expression before or the expression after
the operator - matches or .
Since the characters `(', `)', `[', `]', `.', `*', `?', `+', `^' and `$' are used as special symbols they have
to be ``escaped'' somehow if they are meant literally. This is done by preceding them with `116"' which therefore
also has to be ``escaped" this way if meant literally.
Next: Appendix: GATTable
Up: Appendix: Regular Expressions
Previous: Regular Expressions in Formal
  Contents
Andre Merzky
2004-05-13
|