The pattern to be searched in the text can be defined by the rules given
below. Note that such rules are very similar to the ones used by Lua, even
though they are not the same. For further information on these patterns,
please refer to the Lua Manual.
c |
Matches a c (non-special) character |
. |
Matches any single character |
[abc] |
Matches an a, b
or c |
[a-d] |
Matches any character between a and
d, including them (just like
[abcd]) |
[^a-dg] |
Matches any character which is neither between
a and d nor a
g |
/d |
Matches any digit (just like [0-9]) |
/D |
Matches any non-digit (just like [^0-9]) |
/l |
Matches any letter (just like [a-zA-Z]) |
/L |
Matches any non-letter (just like [^a-zA-Z]) |
/w |
Matches any alphanumeric character (just like
[0-9a-zA-Z ]) |
/W |
Matches any non-alphanumeric character (just like
[^0-9a-zA-Z ]) |
/s |
Matches any "blank" character (TAB, SPACE, CR) |
/S |
Matches ant non-blank character |
/n |
Matches a newline character |
/t |
Matches a tabulation character |
/nnn |
Matches an ASCII character with a nnn
value (decimal) |
/xnn |
Matches an ASCII character with a nn
value (hexadecimal) |
/special |
Matches the special character literally (/[,
//, /.) |
abc |
Matches a sequence of a,
b and c
patterns in order |
aj bj c |
Matches a pattern a,
b or c |
a* |
Matches 0 or more characters a |
a+ |
Matches 1 or more characters a |
a? |
Matches 1 or no characters a |
(pattern) |
Considers pattern as one character for the above |
fpatterng |
Captures pattern for later reference |
/b |
Anchors to a word boundary |
/B |
Anchors to a non-boundary |
^pattern |
Anchors pattern to the beginning of a line |
pattern$ |
Anchors pattern to the end of a line |
@pattern |
Returns the match found only in the beginning of the text |
%pattern |
Returns the firstmatch found, but searches all the text |
(my|his) |
Matches both my pattern and
his pattern. |
/d/d:/d/d(:/d/d)? |
Matches time with seconds (01:25:32) or without seconds (02:30). |
[A-D]/l+ |
Matches names such as Australia, Bolivia, Canada or Denmark, but not
England, Spain or single letters such as A. |
/l/w* |
my variable = 23 * width; |
^Subject:[^/n]*/n |
Subject: How to match a subject line.1 |
/b[ABab]/w* |
Matches any word that begins with A or B |
from:/s*/w+ |
Captures "sender" in a message from sender
|