Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Extended glob patterns in ${...#..} RE: Un-patch: new pattern matching code
- X-seq: zsh-workers 7399
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>, "Zsh hackers list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: RE: Extended glob patterns in ${...#..} RE: Un-patch: new pattern matching code
- Date: Mon, 9 Aug 1999 10:25:15 +0400
- Importance: Normal
- In-reply-to: <990809042534.ZM25662@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
> Since a closure can match the empty string, the shortest matched portion
> is nothing. However, asking for the longest match definitely doesn't work:
>
> zagzig<9> print ${(SM)foo##*}
> ab12xy
> zagzig<10> print ${(SM)foo##([[:digit:]])#}
>
> zagzig<11>
>
Believe it or not, it does work today. I have no idea, what went wrong yesterday
(I thought, it was the problem of flag order ...):
bor@itsrm2:~%> foo=ab12xy
bor@itsrm2:~%> print ${(SM)foo##[[:digit:]]#}
12
bor@itsrm2:~%> print ${(MS)foo##[[:digit:]]#}
12
But still, this one is probably unexpected:
bor@itsrm2:~%> print ${(MSI:1:)foo##[[:digit:]]#}
12
bor@itsrm2:~%> print ${(MSI:2:)foo##[[:digit:]]#}
2
bor@itsrm2:~%> print ${(MSI:3:)foo##[[:digit:]]#}
The first is O.K. ... and the third is O.K., but the second? I believe, this is
a clear bug. The ``S'' flag must consider only non-overlapped matches (the same
way, sed works).
/andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author