Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RegEx to find html atributes
All attributes:
(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?
A specific attribute (ex. class):
(class)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?
Test it:
https://www.debuggex.com/r/KL_pMoR8_pERK-ah
Credit:
http://stackoverflow.com/questions/317053/regular-expression-for-extracting-tag-attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.