I am looking for a regex to skip data-value="4" attribute from string for example I have a string i.e
Hello this is string <sfpart contenteditable="false" data-value="4">‏</sfpart> and the 4 number in string
Now in the above string I want to replace 4 with lets say <span class="yellow">4</span> but not 4 inside the data-value="4"
I can grab 4 and replace it with the <span class="yellow">4</span> by doing below code
const reg = new RegExp('('4')', 'gi');
const str = str.replaceAll(reg, '<span class="yellow">$1</span>');
But the issue is above regex picking 4 inside data-value attribe and replacing it with the html span tags i.e data-value="<span class="yellow">4</span>" so I want skip that part.
Any genuis to help?