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

Re: PATCH: reverse string subscripting



On Apr 5,  1:22pm, Sven Wischnowsky wrote:
} Subject: PATCH: reverse string subscripting
}
} This is from the debian bug list:
} 
}   % a=abcd
}   % echo $a[1,(r)d]
} 
} didn't work, because it stopped one character too early trying to find
} the matching substring for `d'.

Note the (r) is forward pattern matching, not reverse; (R) is reverse.
Your patch appears to have fixed the bug only for the forward direction:

zagzig% x=abcd
zagzig% echo $x[(r)d]
d
zagzig% echo $x[1,(r)d]
abcd
zagzig% echo $x[(R)d]  
d
zagzig% echo $x[1,(R)d]

zagzig% echo $x[1,(R)c]
abc
zagzig% 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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