Next | Regular Expression Mastery | 50 |

`{m,n}`is straightforward nowIt's like

`*`but keeps track of the number of matches`P{n}`is the same as`P{n,n}`Because it keeps track of the number in a small integer, m and n are restricted to be between 0 and 32767.

There's a non-greedy version

`{m,n}?`which is rarely usedActually

`X*`is implemented with`{m,n}`for nontrivial`X`.This means that

`^(foo|bar)*$`wouldn't match`"foo" x 35000`.Actually the regex engine would run out of stack and dumps core before that

Sometime after 5.004_04 and at or before 5.005_02, this was fixed

n=32767 now has a special meaning; it is used internally to mean infinity

You are no longer allowed to specify 32767 explicitly

Next | Copyright © 2002 M. J. Dominus |