
Working with Character Data 165
? The preceding item is optional and will be matched at most once.
* The preceding item will be matched zero or more times.
+ The preceding item will be matched one or more times.
{n} The preceding item is matched exactly n times.
{n,} The preceding item is matched n or more times.
{n,m} The preceding item is matched at least n times,
but not more than m times.
Table 5.2: Repetition operators for regular expressions.
5.3.1.3 Quantifiers
While matching specific patterns is often all that is needed, there are many
cases where special handling of repeated instances of the regular expres-
sion is useful. For example, one can