Skip to content

Instantly share code, notes, and snippets.

@davidbehan
Created August 29, 2013 11:19
Show Gist options
  • Save davidbehan/6376835 to your computer and use it in GitHub Desktop.
Save davidbehan/6376835 to your computer and use it in GitHub Desktop.
Some regex I use when searching csv, text, html, php files in Sublime Text
# Find non alpha numberic characters, excluding _.,-
[^a-zA-Z\d\s_.,-]
# Find single tag only
html - <html\b[^>]*>
div - <div\b[^>]*>
span - <span\b[^>]*>
font - <font\b[^>]*>
xml namespace - <\?xml\b[^>]*>
xml namespace - <!--\?xml\b[^>]*>
# Find tag and everything inside it
style - <style\b[^>]*>(.*?)</style>
xml - <xml\b[^>]*>(.*?)</xml>
# Find specific attributes
class= - class=\b[^>]*
class= - class=""\b[^>]*
style= - style=\b[^>]*
style= - style=""\b[^>]*
# Find uppercase characters, use CMD + K + L to make lowercase
uppercase - <([A-Z][A-Z0-9]*)\b[^>]*>
# Find comments
<!-- /\* Font(.*)-->
<![endif]-->
<!--[if gte mso 9]>
<!--[if gte mso 10]>
# Find empty lines
\n\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment