Skip to content

Instantly share code, notes, and snippets.

@jlnwlf
Last active December 29, 2015 17:39
Show Gist options
  • Save jlnwlf/7705401 to your computer and use it in GitHub Desktop.
Save jlnwlf/7705401 to your computer and use it in GitHub Desktop.
Useful Regex I could use someday...
Matching href without " or ' (with escaping support):
(?<=href\=('|"))((?!\1).)+
Matching youtube video URLs without " or ' (with escaping support)
(?<=href\=('|"))(((http(s)?:)?//)?(youtube.com))?/watch\?((?!\1).)+
Matching any >1 consecutive empty lines:
(?<=\s\n)(\s*\n)
Matching per line slash (/) separated values without slashes
([^/\r\n]+)
Matching <% ... %> code blocks in Mako templates
<%(.*?\n?)+?%> and the less memory killer (sublime text): (?s)<%.+?%> (flag s for multiline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment