[SLUG] regex (for spam filtering in pan)

From: draeath (draeath@gmail.com)
Date: Fri Aug 21 2009 - 06:14:39 EDT


Fellow sluggers, I need your help.

I want to build a regex that would match an email in the form "NAME <ADDR>"

Now, let me try to explain how I want the match to work. Maybe you can
help me build a working regex, I couldn't figure it out

Given ABCDE

A = any alpha string or two alpha strings seperated by a space ("John
Doe" or "John" but not "John A Doe" or "J4ne Doe")
B = Single space char
C = less-than (<) char
D = any length alpha-only string, followed by either 2 digits or 4
digits (ie, "john02 or "john2002" but not "power2you")
E = "@gmail.com>"

An example address: "Stupid Spammer <lovespam04@gmail.com"
A = "Stupid Spammer"
B = " "
C = "<"
D = "lovespam04"
E = "@gmail.com>

Example matching addresses:
John Doe <john09@gmail.com> (both parts match)
John <john2009@gmail.com> (both parts match)

Example non-matching addresses:
draeath <draeath@gmail.com> (NAME matches but ADDR does not)
John Q Doe <john09@gmail.com> (ADDR matches, but NAME does not)
J4ne Doe <jane123@gmail.com> (neither match)

Getting this right will allow me to score down google groups spammers
on usenet, while leaving most 'normal' people alone.
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 13:23:39 EDT