Re: [Exim] help

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Thomas Kinghorn
CC: Exim-Users (E-mail)
Subject: Re: [Exim] help
On Wed, 29 Oct 2003, Thomas Kinghorn wrote:

> I am still trying to come to grips with regex's.


pcretest is your friend.

> I am using the one below to reject variations on "SEX"
>
> \b[Ss][ ./_*-]*[Ee][ ./_*-]*[Xx]\b
>
> Is this syntax correct.


Syntax is correct. Semantics depend on what you want to match. :-)
That matches the sequence

word boundary, S or s, zero of more of space./_*-, E or e, zero or
more of space./_*-, X or x, word boundary

which seems plausible enough. You might like to write \s instead of the
space - that will match tabs as well. Of course, you have to take care
when putting this regex into Exim; you will need to escape backslashes
in an expanded string. Also, you can use (?i) for case-independent
matching. Thus:

?(i)\bs[\s./_*-]*e[\s./_*-]*x\b

But that's just a matter of style really.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book