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

Bad "bad pattern" in ${foo//pat/repl} ?



(Never mind why the elements of $foo have spaces in them, I was fooling
with something else when I came across this.)

schaefer<501> foo=("a b" "a c" "b q" "x y")                                    
schaefer<502> echo ${foo/#a*/yes}
yes yes b q x y
schaefer<503> echo ${foo//#a*/yes} 
a b a c b q x y
schaefer<504> setopt extendedglob 
schaefer<505> echo ${foo/#a*/yes}
yes yes b q x y
schaefer<506> echo ${foo//#a*/yes}    
zsh: bad pattern: #a*

Surely both 503 and 506 are bugs (probably the same bug).  One should be able
to anchor to the beginning of the string even when doing a replace-all (I do
admit it doesn't really make sense to do so, but ...).

-- 
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