" inside the string if the brackets exist using a regular expression I want to replace < on

How to convert & gt; and & lt; with "<" and ">" inside the string if the brackets exist using a regular expression

I want to replace &lt; on <and &gt; s> using a regular expression if any brackets or both brackets exist in a string. since I can check if these brackets exist inside the regex string and replace any of them with <and> respectively.

+4
source share
1 answer
 '&lt; example string &gt;'.replace(/\&lt;/g, '<').replace(/\&gt;/g, '>') 
+1
source

All Articles