Re: [Exim] regex problem (PCRE)

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: Bernard Stern
Cc: exim-users
Asunto: 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.