I am cleaning up XML files that contain HTML by using RegEx.
Some files contain multiple style
-elements and I want to remove them all and content in between. For example:
<STYLE>
group 1
</STYLE>
Random text here which shall not be removed.
<STYLE>
group 2
</STYLE>
Some more random text here which shall not be removed.
<STYLE>
group 3
</STYLE>
I am using the following RegEx with /s parameter
(<STYLE>).*(<\/STYLE>)
Problem is that this RegEx will match everything between <style>
(#1
) and last </style>
(#3
).
I would like to match only group
, <style>
, and </style>
elements. How can this be accomplished?