I am trying to make a regex to find any element that has a specific class.
For example
<span class = "float">
For which I came up with this:
\s*class\s*=\s*('|")\s*float\s*('|")\s*
But then of course you can have multiple CSS declared
<span class = "float align cssnames">
I am not sure how you would make everything else optional.
Maybe
\s*class\s*=\s*('|")[\w\s]*\bfloat\b[\w\s]*('|")\s*?In between the quotes it looks for
floatwith a word boundary on either side, possibly surrounded by further word characters and/or spaces (i.e. other CSS classes).