Ajax software
Free javascripts
↑
Main Page
Figure A-20
{n,}
Sometimes, you will want there to be an unlimited number of occurrences. You can specify an unlimited
maximum number of occurrences by omitting the maximum-occurrence specifier inside the curly braces.
To specify at least two occurrences and an unlimited maximum, you could use the following problem
definition:
Match an uppercase
A
. If there is a match, attempt to match an uppercase
B
. If there is a match, attempt
to match an uppercase
C
. If all three uppercase characters match, attempt to match a minimum of two
occurrences and an unlimited maximum occurrence of three numeric digits.
You can express that using the following pattern:
ABC[0-9]{2,}
Figure A-21 shows the appearance in OpenOffice.org Writer. Notice that now all four numeric digits in
ABC8899
form part of the match, because the maximum occurrences that can form part of a match are
unlimited.
340
Appendix A: Simple Regular Expressions
bapp01.qxd:bapp01 10:47 340
Ajax software
Free javascripts
→