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

Re: Quantifier ( braces in regexp )



On Mon, Jul 23, 2007 at 09:31:17AM +0200, antho.charles@xxxxxxxxx wrote:
> Hi everyone,
> 
> 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?
[...]

I don't think there is and it's true that's a missing one, I'd
say.

Recent ksh93s have {n,p}(expr).

In zsh, you can do something like:

${(l:20::?:)~:-} for .{20}

and

${(l:20::?:)~:-}${(l:40::(?|))~:-}

for .{20,30}

but that's a bit convoluted.

See also ${${(r:30:):-${(l:20::.:):-}}:gs: :(?|)::gs/./?}

-- 
Stéphane



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