More patterns
Multiple patterns
In addition to single characters and strings, the following notation can be used to choose multiple patterns or to specify a digit or a space:
(a|b)
for either string a or string b[a3]
for any of the characters in the brackets[3-5]
for any character in the range\d
any digit\s
white space
The notation can also be used in combination, such as in the following example patterns:
\d\s
for a digit followed by a spaceHi(s|t)
for eitherHis
orHit
([3-5]|[7-9])
for any of 3, 4, 5, 7, 8, or 9
Make sure not to add extra blanks or any other extra symbols.
Position and repetition
It is also possible to use a pattern to indicate where the match should take place in a word and how many times the pattern should be repeated.
\b
match at beginning (if placed before) or ending (if placed after) of a word+
means at least one of what comes before*
means zero or more of what comes before?
means zero or one of what comes before
Here are some examples:
\bth
for th at the beginning of a wordth\b
for th at the end of a worda*
for zero or more a'she+
for h followed by at least one e(he)+
for at least one he
Again, these can be used in combination with other notation for patterns.