procmail
[Top] [All Lists]

Re: equivalent for backreference \n

2002-08-05 09:45:14
Hanspeter Roth <hanspeter_roth(_at_)hotmail(_dot_)com> writes:
obviously the regular expressions in procmail are similar as those
of egrep. So it seems there is no backreference \n.

I want to use something like [0-9]\1\1 to match a sequence of three
equal digits. This should match 111 and 222 but not 122.

Is there something equivalent in procmail/egrep?

There is no fully general method of emulating backreferences in the
regular expressions understood by procmail or POSIX egrep.  If you need
backreferences then you'll need to invoke grep:

        # The first condition keeps us from invoking grep if the
        # Subject doesn't contain any of the required characters
        # and extracts the part of the subject that does contain
        # them.  That value (in the MATCH variable) is then fed
        # into grep in the second condition for the 'real' test.
        :0
        * ^Subject:[^-!-,:-(_at_)]*\/[-!-,:-(_at_)](_dot_)*
        * MATCH ?? ? grep '\([-!-,:-(_at_)]\)\1\1'
        action-here


Philip Guenther
Procmail Maintainer
_______________________________________________
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>