I'm using a series of regex patterns to remove HTML elements from my code. I need to also remove the style="{stuff}"
attributes that are also present in the file.
At the moment I have style.*?
, which matches only the word style
, however I thought that by adding .*?
to the regex it would also match with zero to unlimited characters after the style declaration?
I also have style={0,1}"{0,1}.*?"{0,1}
which matches:
style=""
style="
style
But does not match style="something"
, again in this regex I would expect the .*?
to match everything between the first "
and the second "
, but this is not the case. What do I need to do to change this regex so that it will match with all of the following:
style="font-family:"Open Sans", Arial, sans-serif;background-color:rgb(255, 255, 255);display:inline !important;"
style=""
style="something"
style