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

Re: Example of use of (S) flag



On Wed, 2015-12-23 at 21:01 -0800, Bart Schaefer wrote:
> Further note that (MS) is sort of a dumbed-down form of backreferences,
> returning something similar to the value of $MATCH in an extendeglob
> pattern that uses (#m) (except extendedglob is not needed).  E.g.:

8< snip >8

> torch% echo ${(S)a/b*/x}
> axcba
> torch% echo ${(S)a//b*/x}
> axcxa

I don't understand why in these two examples the star doesn't match the
rest of the string?  I'd expect:

% echo $a
abcba
% echo ${(S)a/b*/x}
ax
% echo ${(S)a//b*/x}
ax

Since b* should match the entire bcba substring.
What did I miss?

Phil.




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