I am trying to wrap each word in HTML string with a span tag. The following regex is working but I am getting error sometimes invalid regular expressions in react native ios and android both and it may be due to negative look behind can anyone help to replace this regex?
htmlStr.replace(/(?<!(<\/?[^>]*|&[^;]*))([^\s<]+)/g, ‘$1<span class="word">$2</span>‘)