Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created June 10, 2010 00:22
Show Gist options
  • Save indexzero/432393 to your computer and use it in GitHub Desktop.
Save indexzero/432393 to your computer and use it in GitHub Desktop.
Match any well formed tags
(<([^<\>]*)>(.*?)</([^<\>]*)>|<([^<\>]*)/>)
Match any tag (with a couple variations) or anything between tags
(>[^<\>](.*?)<|<([^<\>]*)>|</([^<\>]*)>|<([^<\>]*)/>)
-> First Group (i.e. anything between tags isn't matching in RegexBuddy)
Match any tag (with one variation):
(>[^<\>](.*?)<|<([^<\>]*)>)
-> First Group (i.e. anything between tags isn't matching in RegexBuddy)
var html = "<div foo='foo'><nr/>foo<div>foobar</div><div><div><div></div>"
var split = html.split(/(<[^<\>]*>)/);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment