procmail
[Top] [All Lists]

Re: extracting information

1999-09-07 23:26:55
Bill McClatchie <wmcclatc(_at_)primenet(_dot_)com> writes:
What I would like to do is capture the last segment of everything after
the @ in the from line.  i.e., 

x(_at_)y(_dot_)com
x(_at_)a(_dot_)y(_dot_)com
x(_at_)a(_dot_)b(_dot_)y(_dot_)com

I would want to get y.com.  

Since you need to 'peek ahead' a character to recognize when the hostname
part is done, you'll two conditions: one to extract what you want plus
the peek ahead character, and one to extract from _that_ match just the
part you want:

        * ^From:.*@([-a-z0-9]+\.)*\/[-a-z0-9]+\.[-a-z0-9]+([^-a-z0-9.]|$)
        * MATCH ?? ^^\/[^.]+\.[-a-z0-9]+
        


A closed mouth gathers no foot.

Or, to quote the Sluggy Freelance cartoon, "It's hard to run with both
feet in your mouth."


Philip Guenther

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