Last active
August 3, 2016 11:45
-
-
Save kendfrey/51f3af1759c9e463c6e9 to your computer and use it in GitHub Desktop.
HTML Regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^(?:\<(?<T>[A-Za-z][\w:.-]*)(?:\s+[A-Za-z][\w:.-]*=(?:"[^"]*"|'[^']*'))*\s*(?<-T>/)?\>|\</(?<-T>\k<T>)\>|(?:[^<&]|&(?:[A-Za-z]+|#\d+|#x[\da-fA-F]+);)+|<!--(?:[^-]|-(?!-))*-->|<!\[CDATA\[(?:[^\]]|](?!]>))*]]>)*(?(T)(?!))$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment