RegEx Examples
Examples of RegEx for checking SMTP headers.
Originally from Alan Mercer of Catholic Charities Maryland
Original Subject: spamscreen gift
Originally Posted: 1/19/2007 12:53:53 PM on the old Forum WFS boards
Copied from those boards prior to its demise.
Edited to reduce the size of the list 4/17/2020
spamscreen was an anti-spam offering for WFS - the software prior to Fireware
Usual disclaimers apply, use at your own risk.
- Subject contains Paris and Nicole" ^((?i)Subject):\s(?i).(paris).nicole
- Subject Contains \"hot Chicks\"" ^((?i)Subject):\s(?i).*hot chicks
- Subject Contains \"nasty things\"" ^((?i)Subject):\s(?i).*nasty things
- Subject contains variants of \"blowjob\"" ^((?i)Subject):\s(?i).*b.?l.?(o|0).?w.?j.?(o|0).?b
- Subject contains variants of \"boner\"" ^((?i)Subject):\s(?i).*b.?(o|0).?n.?(e|3).?r
- Subject contains variants of \"Boob\"" ^((?i)Subject):\s(?i).*B.?(o|0).?(o|0).?b
- Subject contains variants of \"Breast\"" ^((?i)Subject):\s(?i).*B.?r.?(e|3).?(\@|a).?(s|\$).?t
- Subject contains variants of \"clitoral\"" ^((?i)Subject):\s(?i).*c.?l.?(i|l|1||).?t.?(o|0).?r.?(\@|a).?l l
- Subject contains variants of \"clitoris\"" ^((?i)Subject):\s(?i).*c.?l.?(i|l|1||).?t.?(o|0).?r.?(i|l|1||).?(s|\$)
- Subject contains variants of \"creampie\"" ^((?i)Subject):\s(?i).*c.?r.?(e|3).?(\@|a).?m.?p.?(i|l|1||).?(e|3)
- Subject contains variants of \"cum\"" ^((?i)Subject):\s(?i).*c.?u.?m
- Subject contains variants of \"dildo\"" ^((?i)Subject):\s(?i).*d.?(i|l|1||).?l.?d.?(o|0)
- Subject contains variants of \"erotic\"" ^((?i)Subject):\s(?i).*(e|3).?r.?(o|0).?t.?(i|l|1||).?c
- Subject contains variants of \"fetish\"" ^((?i)Subject):\s(?i).*f.?(e|3).?t.?(i|l|1||).?(s|\$).?h
- Subject contains variants of \"gangbang\"" ^((?i)Subject):\s(?i).*g.?(\@|a).?n.?g.?b.?(\@|a).?n.?g
- Subject contains variants of \"horney\"" ^((?i)Subject):\s(?i).*h.?(o|0).?r.?n.?(e|3).?y
- Subject contains variants of \"kinky\"" ^((?i)Subject):\s(?i).*k.?(i|l|1||).?n.?k.?y
- Subject contains variants of \"lesbian\"" ^((?i)Subject):\s(?i).*l.?(e|3).?(s|\$).?b.?(i|l|1||).?(\@|a).?n
- Subject contains variants of \"masterbate\"" ^((?i)Subject):\s(?i).*m.?(\@|a).?(s|\$).?t.?(e|3).?r.?b.?(\@|a).?t.?(e|3)
- Subject contains variants of \"naked\"" ^((?i)Subject):\s(?i).*n.?(\@|a).?k.?(e|3).?d
- Subject contains variants of \"nudity\"" ^((?i)Subject):\s(?i).*n.?u.?d.?(i|l|1||).?t.?y
- Subject contains variants of \"orgie\"" ^((?i)Subject):\s(?i).*(o|0).?r.?g.?(i|l|1||).?(e|3)
- Subject contains variants of \"orgy\"" ^((?i)Subject):\s(?i).*(o|0).?r.?g.?y
- Subject contains variants of \"panties\"" ^((?i)Subject):\s(?i).*p.?(\@|a).?n.?t.?(i|l|1||).?(e|3).?(s|\$)
- Subject contains variants of \"pervert\"" ^((?i)Subject):\s(?i).*p.?(e|3).?r.?v.?(e|3).?r.?t
- Subject contains variants of \"pussies\"" ^((?i)Subject):\s(?i).*p.?u.?(s|\$).?(s|\$).?(i|l|1||).?(e|3).?(s|\$)
- Subject contains variants of \"twat\"" ^((?i)Subject):\s(?i).*t.?w.?(\@|a).?t
- Subject contains variants of \"vibrator\"" ^((?i)Subject):\s(?i).*v.?(i|l|1||).?b.?r.?(\@|a).?t.?(o|0).?r
- Subject deals with adult" ^((?i)Subject):\s(?i).*adult (?:movie|passwords|site|free)
- Subject deals with cuss words" ^((?i)Subject):\s(?i).*(?:[inappropriate word]|god[inappropriate word]|bitch)
- Subject deals with teen" ^((?i)Subject):\s(?i).*teen (?:movie|password|site|video)
- 5 or more consecutive consonants in subject:" ^((?i)Subject):\s(?i).*(b|c|d|f|g|h|j|k|l|m|n|p|q|r|s|t|v|w|x|z){5}
- 6 or more numbers in sender address" ^((?i)From):\s.*([\d]){6}
- All numeric Domain" ^((?i)From):\s.*@([\d]){1,12}.
- Blank subject" ^(?:(?i)Subject):\s{0,2}$
- Contains \"Expert" ^((?i)Subject):\s(?i).*\s+(expert)
- Contains empty subject" ^(?:(?i)Subject):\s<>
- Contains Pharmacy mispelling" ^((?i)Subject):\s(?i).*\s+(phamacy|phmacy)
- Exclusion to 3 or more consecutive occurences of a vowel # 2" ^((?i)Subject):\s(?i).*(eye)
- Exclusion to home variant" ^((?i)Subject):\s(?i).*homeless
- Exclusion to porn" ^((?i)Subject):\s(?i).*exploring
- Exclusions to 3 or more consecutive vowel rule" ^((?i)Subject):\s(?i).*(ieee|\sAAA\s|iou|eau|you|ayo|oyee|year|aye|loyola|loyal)
- From Bogus Catholic Charities" ^((?i)From):\s.(info|register|admin|tech|webmaster|service|support).(catholiccharities-md.org|cc-md.org)
- From Catholic Charities internet e-mail address possibly bogus" ^((?i)From):\s.*(@catholiccharities-md.;org|cc-md.org)
- From KNOWN SPAMMER" ^((?i)From):\s.*(@email.com)
- From Peg@pandora.be" ^((?i)From):\s.(peg).(pandora).(be)
- From undesirable NOREPLY" ^((?i)From):\s.*(noreply)
- From undesirable PRODUCTTESTERSNEEDED.INFO" ^((?i)From):\s.*(producttestersneeded.info)
- From undesirable SMILEYS" ^((?i)From):\s.*(smileys)
- From undesirable SONYPLAYSTATION" ^((?i)From):\s.*(sonyplaystation)
- From undesirable SYSTEMSOAP" ^((?i)From):\s.*(systemsoap)
- From undesirable top level domain" ^((?i)From):\s.*.(?i)(?:ar|at|au|be|biz|bg|br|ca)(>|)|\s)$
- From undesirable top level domain" ^((?i)From):\s.*.(?i)(?:cc|ch|cl|cn|cz|de|dk|es)(>|)|\s)$
- From undesirable top level domain" ^((?i)From):\s.*.(?i)(?:fi|fr|gr|hk|hu|ie|il|is|it)(>|)|\s)$
- From undesirable top level domain" ^((?i)From):\s.*.(?i)(?:jp|kr|lv|mx|nl|no|nz|ph|pk|pt|ru)(>|)|\s)$
- From undesirable top level domain" ^((?i)From):\s.*.(?i)(?:se|sg|si|sk|su|th|tm|tr|tw|uk|ve|vn|ws|yu|za)(>|)|\s)$
- From unused Catholic Charities e-mail domain" ^((?i)From):\s.*(catholiccharities-md.com|cc-md.com|catholiccharities-md.info|cc-md.info|catholiccharities-md.net|cc-md.net|returnofthedragons.com|returnofthedragons.org)
- Has X-SPAM-Flag = yes" ^((?i)X-Spam-Flag):\s(?i)(yes)
- Has X-Spam-Status = yes" ^((?i)X-Spam-Status):\s(?i)(yes)
- Possible Spoofed From internet in display name" ^((?i)From):\s.(?:@).(?:<).*(?:@)
- PROBABLE PHISHING" ^((?i)Subject):\s(?i).(ebay|paypal|citibank|suntrust).(account)
- Received from Admin" ^((?i)Received):\s.*.(admin)
- Received from dial-up, dsl, or cable" ^((?i)Received):\s.*.(dial-up|dsl|adsl)
- Received from FastQuickSpeed.com" ^((?i)From):\s.*@fastquickspeed.;com
- Received from localhost" ^((?i)Received):\s.*.(localhost)
- Received from undesirable German domain" ^((?i)Received):\s.*.(?i)(t-dialin)(?:com|net)(\s|\t)
- Received from undesirable top level domain" ^((?i)Received):\s.*.(?i)(?:ar|at|au|be|biz|bg|br|ca)(\s|\t)
- Received from undesirable top level domain" ^((?i)Received):\s.*.(?i)(?:cc|ch|cl|cn|cz|de|dk|es)(\s|\t)
1
Sign In to comment.
Comments
More:
More:
More:
More:
More:
More:
More:
Further word of advice when perusing and using this list: Some rules must work in tandem as certain rules may result in frequent false positives unless the offsetting rule exists. Samples include
Exclusion to porn" ^((?i)Subject):\s(?i).*exploring
Subject contains 3 or more consecutive vowels" ^((?i)Subject):\s(?i).*(a|e|i|o|u|y){3}
Subject contains FIST" ^((?i)Subject):\s(?i).*f.{0,1}(i| |l|1|||i).{0,1}(s|z|5).{0,1}(t|+)
Subject contains First" ^((?i)Subject):\s(?i).*first
Subject contains OEM" ^((?i)Subject):\s(?i).*(oem|o e m)
Subject contains POEM" ^((?i)Subject):\s(?i).*poem
Subject contains home variant" ^((?i)Subject):\s(?i).*h.{0,2}(o|0|\@).{0,2}m.{0,2}(e|3| | | | )
Exclusion to home variant" ^((?i)Subject):\s(?i).*homeless
Subject contains ANAL variant" ^((?i)Subject):\s(?i).*\s(anal|an\@l|\@nal|\@n\@l|ana1)
In addition the following rule checks a blank subject line - note subject header exists but is blank
- Contains empty subject" ^(?:(?i)Subject):\s<>
The following tests for the existence of a subject header - note subject header does not exist, this rule can be modified for the default starting value and other tests for desired headers can be added with negative weights as well
More:
Further word of advice when perusing and using this list: Some rules must work in tandem as certain rules may result in frequent false positives unless the offsetting rule exists. Samples include
Exclusion to porn" ^((?i)Subject):\s(?i).*exploring
Subject contains 3 or more consecutive vowels" ^((?i)Subject):\s(?i).*(a|e|i|o|u|y){3}
Subject contains FIST" ^((?i)Subject):\s(?i).*f.{0,1}(i| |l|1|||i).{0,1}(s|z|5).{0,1}(t|+)
Subject contains First" ^((?i)Subject):\s(?i).*first
Subject contains OEM" ^((?i)Subject):\s(?i).*(oem|o e m)
Subject contains POEM" ^((?i)Subject):\s(?i).*poem
Subject contains home variant" ^((?i)Subject):\s(?i).*h.{0,2}(o|0|\@).{0,2}m.{0,2}(e|3| | | | )
Exclusion to home variant" ^((?i)Subject):\s(?i).*homeless
Subject contains ANAL variant" ^((?i)Subject):\s(?i).*\s(anal|an\@l|\@nal|\@n\@l|ana1)
In addition the following rule checks a blank subject line - note subject header exists but is blank
- Contains empty subject" ^(?:(?i)Subject):\s<>