Need a Javascript code snippet that can identify <, >, & and replace it with < ,> , & in a given string, where they are appearing individually and not part of a html or ssml tag.
For example-
'This is a <b>bold</b> & <i>italic</i> text. While this < is a non closing bracket like this <3.'
Should be converted to
'This is a <b>bold</b> & <i>italic</i> text. While this < is a non closing bracket like this <3.'
Tried multiple regex logic but one or the other edge case is always failing. Any help would be appreciated.