Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: file globbing
> On 05 August 2021 at 16:14 Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Say I have these files:
>
> 0 [2021-08-05--07:58] d,1
> 0 [2021-08-05--07:59] d,1,first
> 0 [2021-08-05--07:59] d,1,second
>
> I want a glob that captures them all but:
>
> $ print -l d,1[^[:digit:]]*(N)
> d,1,first
> d,1,second
Yes, indeed it looks like this is available by default (you don't even need EXTENDED_GLOB).
d,1([^[:digit:]]*|)(N)
The (either_this|or_that) matches either what you originally said or nothing ("or_that" here is empty).
There are other ways of doing it, and there's a ksh/bash-compatible way, too, but that's probably
the one I'd immediately reach for.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author