Re: [Exim] regex problem (PCRE)

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Bernard Stern
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] regex problem (PCRE)
On Fri, 3 Aug 2001, Bernard Stern wrote:

> I need to match 'any line ending in '"' but not in '\"'.
> So my regex looks like:
>
> /(?<!\\)"$/
>
> then:
>
> re> /(?<!\\)"$/
> data> fdsafsdfdfda"
> 0: "
>
> which is ok, but
>
> data> dfasdfdaf\"
> 0: "
>
> which should not be ok.


Your regex is fine. What you have overlooked is that pcretest notices
backslashes in its data strings! You need to type

dfsasdfd\\"

to get it to pass a line containing

dfsasdfd\"

to PCRE. Check out the pcretest spec.

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