Information Technology Reference
In-Depth Information
Table 4-2 Examples of Atoms
Regular Expression
Usage
^a.$
Matches a string that begins with character a and ends with any
single character, such as ab, ax, a., a!, a0, and so on.
^100_
Matches 100, 100 200, 100 300 400, and so on.
^100$
Matches 100 only.
^100_500_
Matches 100 500, 100 500 500, and so on.
100$|400$
Matches 100, 2100, 100 400, 400, 100 100, 1039 2400, 600 400,
and so on.
^\(65000\)$
Matches (65000) only.
Table 4-3 shows the common multiplier characters.
Table 4-3 Multipliers and Their Usage
Multiplier
Usage
*
Any sequence of the preceding character (zero or more
occurrences).
+
One or more sequences of the preceding character (one or more
occurrences).
?
Matches a preceding character with zero or one occurrences.
A multiplier can be applied to a single-character pattern or a multicharacter pattern. To
apply a multiplier to a multicharacter pattern, enclose the pattern in parentheses. Some
simple examples are shown in Table 4-4.
Table 4-4 Examples of Multipliers
Regular Expression
Usage
abc*d
Matches abd, abcd, abccd, abcccd, and so on.
abc+d
Matches abcd, abccd, abcccd, and so on.
abc?d
Matches abd, abcd, abcdf, and so on.
a(bc)?d
Matches ad, abcd, cabcd, and so on.
a(b.)*d
Matches ad, ab0d, ab0b0d, abxd, abxbxd, and so on.
 
Search WWH ::




Custom Search