Le Wednesday 11 October 2006, à 14:29:06PM +0100, Peter a écrit : > Frank Terbeck wrote: > > list=("... one giraffe ..." "... two cows ..." "... one monkey ..." "... thre > > e lemmings ...") > > slist=(${(M)list:#*one [a-z]*}) > > To get the exact effect arno wants, you need an additional substitution > to remove the extra stuff, which brings it back to his original > proposal. I'd probably just do the simple > > slist=(${${${(M)list:#*one [a-z]*}##*one }%% *}) Thanks to you and frank for your answers, that works fine. > > I can't offhand think of a way of both matching the one and extracting > the following word in one go. In practice it's unlikely to make a > noticeable difference unless you're really doing this a great deal---and > if speed's that important it's probably time to switch to a more > optimized scripting language. I don't really need that much speed, I was just wondering if was possible to match and extract in one go. Anyway, using another language is not an option here: I'm trying to write a completion function. arno
Attachment:
signature.asc
Description: Digital signature