procmail
[Top] [All Lists]

Re: problem with \/

1998-08-31 18:28:49
Justin Lloyd <jlloyd(_at_)harris(_dot_)com> writes:
:0
* ^Subject: New WorkOrder Request for HISD
{

  :0 
  * B ?? ^Work Order Summary : \/.*$
  {
     :0
     * MATCH ?? ^^\/.+
     { SUMMARY = "$MATCH" }
  }
...
I have the above in my .procmailrc.  At first, I did not have the

  MATCH ?? ^^\/.+

tricks for removing newlines, and I was getting snagged by that.  My subjects
were ending up with two embeded newlines, throwing the rest of my filters off.
Even 

  # note the +, not a *
  :0
  * B ?? ^Work Order Summary : \/.+$     
  ...

was not working.

So when I discovered the trick in Jari's pm-tips.txt, I tried it and it worked
perfectly.  What I am not sure of is *why do I need it*?  Since . does not
match newline, isn't \/.*$ enough to get the line without the newline?  Or is
there something I'm forgetting about procmails regex engine?

In procmail regexps, '$' matches a literal newline, the beginning of
the area being searched, or the end of the area being searched.  '^'
is the same.  Therefore, if you put a '$' after the '\/' match token
then procmail will include the matched newline if there's one there.

Solution?  Don't put a dollarsign there unless you really want a
newline.  Procmail always does greedy matching after the '\/', so the
following should work:

        :0 
        * B ?? ^Work Order Summary : \/.+


Philip Guenther

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