I am trying to find all commas between two words and replace them with another string in JS. I've tried literally every solution I've found but failed.
I have this HTML snippet (this is just a string looking like an html and not a real html document)
<style>
a,span{color:#29728D;text-decoration: underline;}
a:hover{ color:#69621C;text-decoration: underline;}
body, td{font-size:9pt; color:#333333}
</style>
<p>red, white, blue</p>
Now what I wanna do is replace those commas in the style tag with a random word such as "comma" or something.
But not replacing the commas in p or any other tags.
Closest I got was something like
(?<=(le>\w)*),+(?=\w|\W(<\/style>))
but did not work.
Any help would be appreciated.