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

RE: Un-patch: new pattern matching code



>
> The other cpp definition is BACKREFERENCES, which enables backreferencing
> of parentheses in patterns like sed and perl do.  I haven't enabled it
> because I don't know what, if anything, I'm going to do with it.

This may prove useful for ${.../...} case at least. More general use depends on
scope of these references. If e.g. the result of last pattern mathing is
available (much like in Perl) as, say, ``pattern'' array, than it may be even
more useful in case like

if [[ ... == ... ]]
    foo="$pattern[1]-$pattern[3]"

that would completely eliminate need of expr. (I am not sure, that there is easy
way in Zsh to extract matched subpattern currently)

/andrej



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