October 2008
Intermediate to advanced
53 pages
1h 57m
English
There are some repeat operators that are not included in the interface—I assume because of an oversight, for they are quite useful:
{n} |
Match exactly n times. For example, \b\w{4}\b finds all four-letter words (\b identifies word boundaries, \w matches letters and digits); ^([\S]+\s){3} matches the first three words of a paragraph (^ is the start of the paragraph; [\S]+ matches any sequence of non-spaces to the first space \s; {3} five times). |
{n,} |
Match at least n times. \b\d{6,} matches all numbers of six digits or more. |
{n,p} |
Match between n and p times (inclusive). \b\w{4,7}\b finds all words between four and seven characters long. |
Read now
Unlock full access