On Wed, 01 Jul 2009, Magnus Bäck wrote:
> > Sahil Tandon wrote:
> >
> > > I prefer pcre:, but the following patterns should work with regexp:
> > > as well.
>
> No, {n} isn't supported by regexp.
It is. As noted in regexp_table(5), each pattern is a POSIX regular
expression, whose syntax is documented in re_format(7). For posterity (and
the interested reader), a relevant excerpt from the man page:
A bound is `{' followed by an unsigned decimal integer, possibly followed
by `,' possibly followed by another unsigned decimal integer, always fol-
lowed by `}'. The integers must lie between 0 and RE_DUP_MAX (255=)
inclusive, and if there are two of them, the first may not exceed the
second. An atom followed by a bound containing one integer i and no
comma matches a sequence of exactly i matches of the atom. An atom fol-
lowed by a bound containing one integer i and a comma matches a sequence
of i or more matches of the atom. An atom followed by a bound containing
two integers i and j matches a sequence of i through j (inclusive)
matches of the atom.
Also see the EXAMPLE BODY FILTER MAP in regexp_table(5) for another example
of how to use bounds with regexp.
--
Sahil Tandon <[email protected]>