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

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



"Andrej Borsenkow" wrote:
> > ${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)/...}.  Unfortunately
there's a bug due to the implementation: (#s) always matches, because the
substitution only passes the tail end of the string.  (#e) works here, but
can fail when we are looking for the shortest match for ${...%...}.  In
principle this isn't hard to keep track of --- the calling code knows
whether the beginning or end of the string passed is really that --- but in
practice it's messy passing the status into pattry() from igetmatch() in
glob.c.  I'll think about this.  Are there any other areas apart from
parameter substitution where the string is longer than we pass to the
pattern matching routines?

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxxxxxxxxxxxxxxxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



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