Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Should we backup this change? RE: Modifier substitutions.
- X-seq: zsh-workers 10714
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: Should we backup this change? RE: Modifier substitutions.
- Date: Wed, 12 Apr 2000 21:54:51 +0100
- In-reply-to: ""Andrej Borsenkow""'s message of "Wed, 12 Apr 2000 19:06:35 +0400." <000601bfa490$b188ed50$21c9ca95@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
"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