Skip to content

Instantly share code, notes, and snippets.

@emilemming
Last active August 21, 2016 09:58
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save emilemming/5f47d19533756d6da4181ad157713109 to your computer and use it in GitHub Desktop.
Save emilemming/5f47d19533756d6da4181ad157713109 to your computer and use it in GitHub Desktop.
EMAIL-GREP-PATTERN
<!-- Please remove all commented out code before using. Visit https://gist.github.com/ccstone/5385334 for more regular expressions available in TextWrangler -->
<!-- \r is line break, \s is non whitespace, \t tab, this looks for table cells and image tags with missing attributes -->
|<td>|<td>\r*?\s*?\t*?<img|(<img\s*(?!.*\r*?.*?\r*?.*?display: ?block.*?\r?))
<!-- image formatting and styles: height, width, block, alt text -->
|<img\s*(?!.*\r*?.*?\r*?.*?height.*?\r?)|<img\s*(?!.*\r*?.*?\r*?.*?width.*?\r?)
<!-- break tag variants -->
|<br/>|<br>
<!-- special characters -->
|’|‘|“|”|ë|é|í|æ|ø|å|á|—|–||©|®|™|…|£|€|myRetirementPlan| & (?!.*</title>)|Q&A(?!mp;)|(?<!Plan)S&P(?!lacement)(?!lan)|</?p>|style\d|\d\:?\d?[\t ](A|P)\.?M\.?|\w[\t ]\d+,[\t ]\d{4}
<!-- formatting and styles for mailto links -->
|href(?!.*?="mailto)(?!.*?target)|href(?!.*?text-decoration)(?!.*?<img)|&subject
<!-- all table cells should have widths and styles declared -->
|<td(?!.*?width)|<td(?!((.*?color)
<!-- check all table cells for background color -->
|<td(?!.*?bgcolor)
<!-- all spacer cells should contain a nonbreaking space, to prevent collapse in some email clients -->
|(.*?>&nbsp;</td>)))
<!-- all phone numbers should have a nowrap tag -->
|(?<!^)(?<![\t])((?<!nowrap">)<strong>(1-\d\d\d-\d\d\d-\d\d\d\d|\(\d\d\d\)|\d\d\d\.\d\d\d\.\d\d\d\d)|(?<!nowrap">|<strong>)(1-\d\d\d-\d\d\d-\d\d\d\d|\(\d\d\d\)|\d\d\d\.\d\d\d\.\d\d\d\d))
<!-- check body style -->
|<body (?!.*style="margin:0;padding:0;width: 100% !important;")
<!-- check for web styles, unprovided links, common errors, bad characters -->
|vspace="|hspace="|font:
|ProvideLink.html|•|¬|it s |&nbsp;(s|re|t|ve)( |\.|,)|.{800}|""|(width|height|colspan|bgcolor|color|border|cellpadding|cellspacing)=\d
<!-- check width -->
|width="\d*"colspan
<!-- no relative urls for images -->
|<img src="(?!(http|##))
<!-- look for target blank in non-mailto links -->
|<a href="(?!(http|mailto|#))|mailto:(?=.*target=)
<!-- outdated tracking tags -->
|##SHORTCLICKTAG##|-xxx -->|##3\d{3}##|"#....."|;;
<!-- corporate style: emdash and endash should not have spaces on either side -->
| &mdash; |(((A|P)\.?M\.?)|\d) &ndash; \d|\w([\t ]|&nbsp;)\d+ &ndash;
<!-- common align typo -->
|algin=
<!-- Outdated brand color -->
|#00425F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment