procmail
[Top] [All Lists]

Re: regexp question(s)

1998-07-01 12:57:07
Jim Murphy wrote,

| The following perl statement does exactly what I want to do(so far):
| 
|       /^Subject:.*(AB|XYZ)[0-9]{5,}/
| 
| but so far I haven't been able to get procmail to catch the lines with this
| kind of statement.

Procmail's built-in egrep simulator doesn't grok braces (neither do a lot of
egreps).  If you want to match a string of five things, you need to list five
in the expression:

    * ^Subject:.*(AB|XYZ)[0-9][0-9][0-9][0-9][0-9]

Since the regexp is not right-anchored and nothing comes after the five
digits, looking for five is the same as looking for five or more; if it
makes you feel better, you can add a plus sign after the last right bracket.

| What I'm looking for is what expressions procmail excepts.  Is their some
| document I can go to that will tell me what procmail can/can't do?

Newer versions of the procmailrc(5) manual page have some detail on that.
^^ and \/ are special to procmail; ^, $, \<, and \> have similar meanings
but work slightly differently.  Braces are not magic.  Stephen once men-
tioned adding support for braces, but if he does, they'll need to be escaped
so as not to break existing rcfiles where they are intended literally.

| If anyone can show me how to rewrite the recipe I wont refuse that either.

See above.

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