UC8000 IPPBX User Manual
46
Table 5.5.3-2 Explanation of frequently-used metacharacters in Regex
^
Matches the starting position in a number string. For example, ^134
matches the numbers starting with 134
$
Matches the ending position of a string. For example, 2$ matches the
numbers ending with 2.
|
Separates alternate possibilities. For example, 2|3|4 means 2,3or 4.
\
Marks the next character as a special character, a literal, a
backreference, or an octal escape
[ ]
Matches a single character that is contained within the bracket. For
example, [123] matches 1, 2, or 3. [0-9] matches any digit from "0" to "9".
[^ ]
Matches any one character except those enclosed in [ ]. For example,
[^9] matches any character except 9.
.
Matches any single character except the newline character. For example,
3.4 matches 314, 324, 334, 344.
?
Indicates there is zero or one of the preceding element. For
example, colou?r matches both color and colour.
*
Indicates there is zero or more of the preceding element. For
example, ab*c matches ac, abc, abbc, abbbc, and so on.
+
Indicates there is one or more of the preceding element. For
example, ab+c matches abc, abbc, abbbc, and so on, but not ac
\d
Mark any digit, equal to [0-9]
\D
Mark any character that is not a digit, equal to [^0-9]
\s
Mark any blank character such as a space or a tab.
\S
Mark any character that is not a blank character.
Examples:
^0755
Matches the phone numbers with starting digits of 0755.
^0755|^8899|^01
Matches the phone numbers with starting digits of 0755, 8899 or