December 1999
Beginner
528 pages
11h 10m
English
Using the * allows us to match any number of matches, but if we want to match only a certain number of occurrences, that’s where \{ \} comes in. There are actually three options in using this pattern match, which are:
| pattern \{n\} | Match n occurrences of the pattern |
| pattern \{n,\} | Match at least n occurrences of the pattern |
| pattern \{n,m\} | Match occurrences of the pattern between n and m, where n and m are integer numbers between 0 and 255 |
Looking at the first examples, suppose we wanted to match only three occurrences of the letter AA, but ending in the letter B, this would do it:
A\{2\}B
This would give me AAB in a match.
If we wanted to match at least four occurrences of the letter ...
Read now
Unlock full access