Re: [Exim] PCRE regex

Top Page
Delete this message
Reply to this message
Author: Kirill Miazine
Date:  
To: Michael Jakscht
CC: exim-users
Subject: Re: [Exim] PCRE regex
Michael Jakscht wrote:
> >     /^([a-z]+)_([a-z]+)(\/InfoTL\.RZV)@vit.de/

> >
> > $1 = user
> > $2 = name
> > $3 = InfoTL.RZV
>
> Okay, this was way good ;-) Thanx,
>
> I made
>
> /^([a-z]+)[\_|\.]([a-z]+)(\/InfoTL\.RZV)@vit.de/i

                           ^             ^
You can remove these parens as you won't be using $3 anyway.


> out of it to catch both dot and underscore.


And pipes...

> I tried to implement this one as a rewriting rule in exim now
> as this rule shows:
>
>
> ======================================
> begin rewrite
>
> ^([a-z]+)[\_|\.]([a-z]+)(\/InfoTL\.RZV)@vit.de/i        "$1 $2
> <$1.$2@???>" Eh
> ======================================


For envelope addresses use $1.$2@???, not "$1 $2 <$1.$2@???>".
And get rid of "/i" at the end of the pattern.

>
>
> So far I just don't exactly know if this notation for exim is allright, I
> just looked in the spec but couldn't find this so fast.
> Tried the debug run with -bh and the following showed up... No good..


You have exim -brw too.

> ======================================
> exim -bh 172.16.1.18
>
> [...]
> >>> michael.jakscht@??? in
> "^([a-z]+)[_|.]([a-z]+)(/InfoTL.RZV)@vit.de/i"? no (end of list)
> >>> Juergen_Struckhoff/InfoTL.RZV@??? in
> "^([a-z]+)[_|.]([a-z]+)(/InfoTL.RZV)@vit.de/i"? no (end of list)
> [...]
> ======================================
>
>
> Okay, hope I made a really stupid mistake again... *lol*


You have. Get rid of that "/i" at the end.

michael.jakscht@??? doesn't contain "/InfoTL.RZV" and in the second
case the address contains upper-case letters. Try following regex:

^([a-zA-Z]+)[_.]([a-zA-Z]+)(\/InfoTL.RZV)?@vit.de$

re> /^([a-zA-Z]+)[_.]([a-zA-Z]+)(\/InfoTL.RZV)?@vit.de$/
data> michael.jakscht@???

0: michael.jakscht@???
1: michael
2: jakscht
data> Juergen_Struckhoff/InfoTL.RZV@???

0: Juergen_Struckhoff/InfoTL.RZV@???
1: Juergen
2: Struckhoff
3: /InfoTL.RZV

--
Kirill Miazine, Stud. Jur.
Faculty of Law, University of Oslo