A quantifier is used to repeat an element. Three examples of quantifiers have already been introduced: *, +, and ?. The quantifiers are as follows:
Description |
Character |
Example |
The preceding character repeated zero or more times |
* |
'abc'-match 'a*' 'abc'-match '.*' |
The preceding character repeated one or more times |
+ |
'abc'-match 'a+' 'abc'-match '.+' |
Optional character |
? |
'abc' -match 'ab?c' 'ac' -match 'ab?c' |
A fixed number of characters |
{exactly} |
'abbbc' -match 'ab{3}c' |
A number of characters within a range |
{min,max} |
'abc' -match 'ab{1,3}c' 'abbc' -match 'ab{1,3}c' 'abbbc' -match 'ab{1,3}c' |
Specifies a minimum number... |