Re: [Exim] regex help needed please

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Philip Hazel
Data:  
Para: Jeffrey Wheat
CC: Exim users list
Asunto: Re: [Exim] regex help needed please
On Tue, 17 Dec 2002, Jeffrey Wheat wrote:

> I am trying to match on the following:
>
> [1\23] 2002-12-17 14:00:09 18OMwr-000JED-00 H=sbs1941.customer.demon.com (jbrserver.sbs1941.customer.demon.com) [194.159.222.168] F=davedader@???> rejected after DATA: ACL-Reject: Forgery:NOT FROM HOTMAIL ( from sbs1941.customer.demon.com ([194.159.222.168] helo=jbrserver.sbs1941.customer.demon.com)
>
> With the following:
>
> if ($text =~ /^[\d\/\d]\s\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d/) {

                 ^
                 ^
[ is a metacharacter in regexes. Your regex starts off


   ^          begins
   [\d\/\d]   a character that is either a digit or /
   \s         a space
   ...


Try backslashing the [] characters. Also, you probably want

\[\d+\/\d+\]

don't you?




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