Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Quantifier ( braces in regexp )



On Mon, 23 Jul 2007 09:31:17 +0200
antho.charles@xxxxxxxxx wrote:
> I search through the doc and I can't find a way to use quantifier in
> expression like [0-9]{2,3} in standard regexp. Is there only * (#), + (##)
> and ? (|) implemented?

You can use <-> syntax to get some of the way.  It falls down if you need
to be strict about leading zeroes, however: if you really insist that
00 matches and 0 doesn't it won't help you.  I suppose I could extend it so
that <00-999> matched a two- or three-digit number (making leading zeroes
significant for the comparison on the left), but that doesn't fix the
general problem.

I will have a look at how difficult quantifiers are, but the syntax will be
different since braces are already used:  probably something like an
extended globbing flag (#c2,3).

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


.



Messages sorted by: Reverse Date, Date, Thread, Author