procmail
[Top] [All Lists]

Re: $MATCH problem

1997-08-11 13:08:00
Francesco Lotti <goo(_at_)ouverture(_dot_)it> writes:
I want extract from the body two consecutive matches..

i.e: subscribe mlist user(_at_)domain
              ^^^^^ ^^^^^^^^^^^
              (1\xB0)     (2\xB0)

I don't know how to handle it because if I put:

*^subscribe \/.*

i get MATCH="mlist user(_at_)domain" while I'd like something like MATCH1=mlist
and MATCH2=user(_at_)domain(_dot_)

Is it possible?

Do it in two steps:

        # First get the entire line.  This guarantees correct behaviour
        # even if there are two lines that start with "subject" in the body.
        :0 B
        * ^subscribe \/[a-z]+ .*
        {
            BOTH = $MATCH

            # extract the command part.  The parens protect the backslash
            # from being treated extra-specially from being at the
            # beginning of the line.
            :0
            * BOTH ?? ()\/[a-z]+
            { COMMAND = $MATCH }

            # extract the address part.
            :0
            * BOTH ?? [a-z]+ \/.*
            { ADDR = $MATCH }

            # do whatever here...
        }

Philip Guenther

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