procmail
[Top] [All Lists]

Re: Regexp bug ? \<(word|word)\> does not match

2000-09-03 07:48:42
On Fri, Sep 01, 2000 at 10:49:14AM -0500, David W. Tamkin wrote:
Andre asked,

| Hello folks. I've found that the regexp engine in procmail v3.15
| 2000/08/25 does not seem to be able to find matches for a regexp
| like
| 
|   \<(several|words|to|match)\>

I'm guessing that the problem is that you have that at the very beginning
of the expression, so procmail strips off the first backslash to mean "end 
of rcfile whitespace, start of regexp" and then looks for a literal left-
side angle bracket, followed by any of the words, followed by a non-word
character.  Since you don't have the literal left-side angle bracket in
the text, there never is a match.

There are two basic methods to work around it:

   \\<(several|words|to|match)\>
or
   ()\<(several|words|to|match)\>

Most of us prefer the second, because the first is counterintuitive: one
expects "\\" to represent a literal backslash, not two magic ones.

Right on. With the () trick, it works now. Thanks. I guess I
should have read the manual more carefully.

| For what it's worth, GNU egrep has no problem with it.

For what it's worth, when you use GNU egrep, you have the expression properly
quoted, don't you?  Then the backslash doesn't get stripped.

For what it's worth, yes.

-- 
André Majorel <amajorel(_at_)teaser(_dot_)fr>
http://www.teaser.fr/~amajorel/

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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