procmail
[Top] [All Lists]

Re: Wierd regex Behavior

1997-01-14 14:18:35
"James V. Di Toro III" <karrde(_at_)gats(_dot_)hampton(_dot_)va(_dot_)us> 
writes:

      I'm trying to filter out the Re: in front of mails and am getting
problems.  The following recipie wont work:

:0 f
* ^Subject: [rR][eE]\:*\/.*
| formail -I "Subject: $MATCH"

      It leaves the ':' in the subject.  What is wrong here is the '\:*'
not matching on to the colon and the colon gets sucked into the $MATCH.
Or is the '\:*' getting sucked into the '\/.*' as one regex that goes into
the MATCH variable.  It's quite anoying because '\:\/.*' works just fine
and the colon gets taken out and all I'm lef with is the subject.  Can
anyone help?

1) Force the first character of the match to be a non-colon.
2) Remember: procmail does case-insensitive matching by default.
3) Why are you escaping the colon?
4) Do you really want to change a subject of "Regarding your letter" into
        "garding your letter"?  I'd suggest you require at least one colon,
        possibly with spaces in front of it. 

:0f
* ^Subject: *re *:+\/[^:].*
|formail -I"Subject: $MATCH"

Make sense?

Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>