Here is a list of the characters that are special in a regular
expression. ‘*’ always applies to the smallest possible
preceding expression. Thus, ‘fo*’ has a repeating ‘o’, not a
repeating ‘fo’. It matches ‘f’, ‘fo’, ‘foo’, and so on. The
matcher processes a ‘*’ construct by matching, immediately, as
many repetitions as can be found. Then it continues with the
rest of the pattern. If that fails, backtracking occurs,
discarding some of the matches of the ‘*’-modified construct in
the hope that that will make it possible to match the rest of
the pattern. For example, in matching ‘ca*ar’ against the string
‘caaar’, the ‘a*’ first tries to match all three ‘a’s; but the
rest of the pattern is ‘ar’ and there is only ‘r’ left to match,
so this try fails. The next alternative is for ‘a*’ to match
only two ‘a’s. With this choice, the rest of the regexp matches
successfully. Warning: Nested repetition operators can run for
an indefinitely long time, if they lead to ambiguous matching.
For example, trying to match the