Oh I wish I was a master of regex, but I guess I lack the mental capacity to formulate complex matches......!!!! So, I manage an email content filtering system (ActiveState PureMessage) which provides filtering for several banks. Right now we have the usual filters in place (like bad words, job search, ect.), though now the banks want to be able to filter on account numbers. This would be easy if they followed a standard number convention.... but no, the most they can give me is that an account number is x digits long. Fine I say, since the filtering is based on regular expressions I can write one to filter for that. The problem is that when a user uses an email client like outlook they get many false positives since the client adds formatting tags in the body of the message (why the formatting tags use number string is beyond me).
So I have set out to write a regex that can take care of this problem, but after about a hundred or so different variations.... I just can not get it down. So I was wondering if any of the Perl guru's might be able to help me. This is what I need the regex to do in a nutshell:
Searching for a 7 digit string:
<SPAN class=3D319263020-11082003>Test Hello</SPAN> # NO MATCH
<SPAN class=3D319263020-11082003>1234567</SPAN> # MATCH
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.