Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?>(\b(?:(?:[0-9]{7}|[0-9]{10,11})|[a-zA-Z][0-9]{10})\b)[^\r\n]*?(\b(?:\d{1,2}|(?:(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember|(?:t\.?|\.))?|Oct(?:ober|\.)?|Nov(?:ember|\.)?|Dec(?:ember|\.)?)))(?:[^A-Za-z0-9\v](?:\d{1,2})\,?[^A-Za-z0-9\v](?:\d{2}|\d{4})|[^A-Za-z0-9\v\.](?:(?:\'|\`)\d{2}|\d{4}))\b)[^\r\n]*?(\$\d+[\.\,\d]*)[^\r\n]*?($))|(?2)[^\r\n]*?(?:(?1)|(?3))[^\r\n]*?(?4)|(?1)[^\r\n]*?(?:(?2)|(?3))[^\r\n]*?(?4)|(?3)[^\r\n]*?(?:(?1)|(?2))[^\r\n]*?(?4)
/
gm

Description

Changes: • Eliminates all named groups • In lieu of recursion (unavailable in .NET), uses repeated groupings in alternating order

For use in defining sensitive terms in Office 365. Not yet confident that this is in line with documentation (tinyurl.com/y4dm6mao).

Submitted by anonymous - 5 years ago