L-VIS User Manual
300
LOYTEC
Version 6.2
LOYTEC electronics GmbH
A
bracket expression
is a list of characters enclosed by
[
and
]
. It matches any single
character in that list; if the first character of the list is the caret
^
then it matches any
character not in the list. For example, the regular expression
[0123456789]
matches
any single digit.
Within a bracket expression, a
range expression
consists of two characters separated by a
hyphen. It matches any single character that sorts between the two characters, inclusive,
using the locale's collating sequence and character set. For example, in the English locale,
[a-d]
is equivalent to
[abcd]
.
Most meta-characters lose their special meaning inside lists, but some characters must be
placed at specific positions, as pointed out below:
To include a literal
]
place it first in the list.
To include a literal
^
place it anywhere but first.
To include a literal
-
place it last.
The following special characters and symbols exist:
The period
.
matches any single character.
The symbol
\w
is a synonym for any alphanumeric character and
\W
is a
synonym for any non-alphanumeric character.
The caret
^
and the dollar sign
$
are meta-characters that respectively match the
empty string at the beginning and end of a line.
The symbols
\<
and
\>
respectively match the empty string at the beginning and
end of a word.
The symbol
\b
matches the empty string at the edge of a word, and
\B
matches
the empty string provided it's not at the edge of a word.
A regular expression may be followed by one of several
repetition
operators:
?
The preceding item is optional and matched at most once.
*
The preceding item will be matched zero or more times.
+
The preceding item will be matched one or more times.
Two regular expressions may be
concatenated
; the resulting regular expression matches
any string formed by concatenating two substrings that respectively match the concatenated
sub-expressions.
Two regular expressions may be
joined
by the infix operator
|
; the resulting regular
expression matches any string matching either sub-expression.
Repetition takes precedence over concatenation, which in turn takes precedence over
alternation. A whole sub-expression may be enclosed in parentheses to override these
precedence rules.
The back-reference
\n
, where
n
is a single digit, matches the substring previously matched
by the
n
th
sub-expression enclosed in
{}
.