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

Re: Extended glob patterns in ${...#..} RE: Un-patch: new pattern matching code



On Aug 8,  2:04pm, Andrej Borsenkow wrote:
} Subject: Extended glob patterns in ${...#..} RE: Un-patch: new pattern mat
}
} > There is ${(MSI:n:)...#...}, where n is a number.
} 
} It looks, like this does not work with extended glob patterns (3.1.6 pure or
} pws-1):
} 
} bor@itsrm2:~%> print ${(SM)foo#([[:digit:]])#}

This is at least partly consistent:

zagzig<7> foo=ab12xy
zagzig<8> print ${(SM)foo#*} 

zagzig<9>

Since a closure can match the empty string, the shortest matched portion
is nothing.  However, asking for the longest match definitely doesn't work:

zagzig<9> print ${(SM)foo##*}
ab12xy
zagzig<10> print ${(SM)foo##([[:digit:]])#} 

zagzig<11> 

} there is subtle problem: searching for "...sub1 ...sub2..." may give
} different results as searching for sub1 first and then for sub2

True.

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



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