Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Un-patch: new pattern matching code
- X-seq: zsh-workers 7395
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: Un-patch: new pattern matching code
- Date: Sat, 7 Aug 1999 17:48:48 +0000
- In-reply-to: <000001bee0b3$8c181970$21c9ca95@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <000001bee0b3$8c181970$21c9ca95@xxxxxxxxxxxxxx>
On Aug 7, 1:02pm, Andrej Borsenkow wrote:
} Subject: RE: Un-patch: new pattern matching code
}
} >
} > The other cpp definition is BACKREFERENCES
}
} If e.g. the result of last pattern mathing is
} available (much like in Perl) as, say, ``pattern'' array
I'd name it something other than `pattern' ... what's in the array is not
the patterns, it's the matched substring of the source string, right?
} I am not sure, that there is easy
} way in Zsh to extract matched subpattern currently)
There is ${(MSI:n:)...#...}, where n is a number. BTW, it looks like (M)
doesn't work right with ${.../...}. Am I missing something?
zagzig% x="abcdefghij"
zagzig% echo ${x/??}
cdefghij
zagzig% echo ${(M)x/??}
cdefghij
zagzig% echo ${(MS)x/??}
cdefghij
zagzig% echo ${(MSI:1:)x/??}
cdefghij
zagzig% echo ${(MSI:2:)x/??}
adefghij
zagzig% echo ${(RSI:2:)x/??}
adefghij
echo ${(MSI:2:)x//??}
ab
zagzig% echo ${(M)x#??}
ab
zagzig% echo ${(MSI:2:)x#??}
bc
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author