RE: [Exim] regex help needed please

Pàgina inicial
Delete this message
Reply to this message
Autor: Jeffrey Wheat
Data:  
A: exim-users
Assumpte: RE: [Exim] regex help needed please
Philip,

    I was doing it the wrong way. Your d+ suggestion was
the key to it all though. Here is the working regex. Hope
someone else is able to use this too.


# this is for messages that contain [1/xx] type entries
if ($text =~ /^\[\d+\\\d+\]\s\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d/) {

Thanks, Jeff

> -----Original Message-----
> From: Philip Hazel [mailto:ph10@cus.cam.ac.uk]
> Sent: Wednesday, December 18, 2002 6:15 AM
> To: Jeffrey Wheat
> Cc: Exim users list
> Subject: 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.

>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.427 / Virus Database: 240 - Release Date: 12/6/2002
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.427 / Virus Database: 240 - Release Date: 12/6/2002