Re: [Exim] PCRE question in system filter

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: Tabor J. Wells
CC: exim-users
Assumpte: Re: [Exim] PCRE question in system filter
On Sat, 21 Apr 2001, Tabor J. Wells wrote:

> Ok. I've figured out the answer but I'm not sure I that I understand
> fully.
>
> The correct pattern is:
>
> "\\\\s{10,}\\\\[\\\\w{4,8}\\\\]"
>
> But what I don't understand is why when I wanted to match:
>
> ]_by
>
> it was sufficient to do "\]_by"


It would have been sufficient to do "]_by" because ] is special only
when it follows ]. However, you have only stated half the difference
here. The original string you posted was

"\\\\s{10,}\[\\\\w{4,8}\]"

which contained "\[" as well as "\]". After dequoting that is

\\s{10,}[\\w{4,8}]

After string expansion it is:

\s{10,}[\w{4,8}]

So the [ and ] are going to be (incorrectly) interpreted as meta
characters in the regex.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.