0

How can I update my regular expression to handle all occurrences of > (that occur between quotation marks)?

\=(("|').*)>(.*("|'))\im

Here is a working example: https://regexr.com/4rjnf

If I run my regex on the following string I only replace one occurrence not all.

Source string: <div attr='.foo > .bar > .baz'><div>
Result from my regex: <div attr='.foo > .bar &gt; .baz'><div>
My desired result: <div attr='.foo &gt; .bar &gt; .baz'><div>

sazr
  • 23,396
  • 63
  • 179
  • 330

0 Answers0