Re: [exim] regex questions

Etusivu
Poista viesti
Vastaa
Lähettäjä: Tony Finch
Päiväys:  
Vastaanottaja: Andrew
Kopio: 'exim-users@exim.org'
Aihe: Re: [exim] regex questions
On Mon, 13 Dec 2004, Andrew wrote:

> regex = <scr[Ii]pt>          Works -
> However
> regex = <[Ss]cr[Ii][Pp][Tt]> fails :(

>
> (I think the combination of the leading < and [] is breaking it.... but I
> don't know why - any advice???).


You are right. < introduces the list separator character, so your working
regex becomes /cr[Ii]pt>/ (using / to quote, perlishly). The failing regex
becomes a list of regexes, most of which are syntax errors /Ss]cr/ or
/Ii]/ or /Pp]/ or /Tt]>/.

You can avoid the < problem by starting the list of regexes with <: to
explicitly set the list separator character to : which is the same as
the default.

Or you can make your regex more readable by setting case-insensitive mode
as in (?i)<script> which also avoids the list separator problem.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}