procmail
[Top] [All Lists]

Re: escaping special characters (in general)

1995-10-30 10:38:56
Soren Dayton had posted,

|  >    If you are using procmail 3.11, $\foo will escape regex
|  > metacharacters in foo

Robert Brown asked,

| Is this supposed to be able to work with ^TO, as in:
|
| :0:
| *^TO$\foo(_at_)bar(_dot_)com
| foo
|
| ?  This doesn't seem to work for me.

It didn't work, Robert, because you didn't have the "$" modifier on the
condition line to make procmail substitute variables in the first place.
Without it, an unescaped dollar sign later in the line represents a newline,
so what you have there is searching for the following:

1. An expression that matches the expansion of the ^TO token (which is
   anchored to the start of a line by its definition), followed by
2. A newline, followed at the start of the next line by
3. "foo(_at_)bar" [the backslash escapes the f, which didn't need escaping],
   followed by
4. any character that is not a newline (the period is unescaped), and finally
5. "com".

Try this instead:

 :0:
 * $ ^TO$\foo(_at_)bar\(_dot_)com
 foo

In fact, to avoid matches to things like 
$foo(_at_)bar(_dot_)community(_dot_)edu, you might
want to do it this way:

 :0:
 * $ ^TO$\foo(_at_)bar\(_dot_)com\>
 foo