Skip to content

Instantly share code, notes, and snippets.

@RaphaelAudet
Created November 15, 2017 08:25
Show Gist options
  • Save RaphaelAudet/eccb87d3507bc93396ababb6c375ecee to your computer and use it in GitHub Desktop.
Save RaphaelAudet/eccb87d3507bc93396ababb6c375ecee to your computer and use it in GitHub Desktop.
regex to match all inline styles in html
style=(["'])(?:(?=(\\?))\2.)*?\1
<!--[^>]*-->
data-identifier=(["'])(?:(?=(\\?))\2.)*?\1
data-index=(["'])(?:(?=(\\?))\2.)*?\1
class=(["'])(?:(?=(\\?))\2.)*?\1
compilesafe=(["'])(?:(?=(\\?))\2.)*?\1
tooltip=(["'])(?:(?=(\\?))\2.)*?\1
this one is not bad
(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment