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

RE: Should we backup this change? RE: Modifier substitutions.



> > > ${foo/$bar/...} into ${foo/\\$bar/...}
> >
> > The problem is (as I discovered later) it is not complete.
> There is no
> > way to anchor pattern to match full string.
>
> You should now be able to do ${foo/(#s)$bar(#e)/...}.

In this particular case I was about to simply use ${...:/...}
(untested). And this is the form I was referred to - you cannot put this
anchor in pattern.

I also believe, that it should be possible to simulate left/right
anchoring by using ${...:/...} and (pat)* or *(pat). May be, it could
match too much, dunno.

BTW where are these (#s) and (#e) useful? The patterns in parameter
expansions are anchored by definition; the patterns in conditional
expressions/case statements are anchored to full word as well. Could you
provide example where you cannot do without (#s)/(#b)?

In any case, this is additional argument in favour of backing out this
change (assuming, that these (#s)/(#b) really work).

-andrej



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