我想用正则表达式代替<和>符号由& lt;和& gt;在HTML文本中,并作为有效的XML。将< and >符号替换为HTML字符串中的<和>符号
示例串:
<HTML><BODY><p style="margin:0px">His <span style="color: rgb(237, 23, 23);">career </span>spanned the development of cinema, from <span style="font-weight: 700;">silent film</span>, through early experiments in <span style="text-transform: uppercase;">Technicolor </span>to filmmaking in the 21st century.</p><p>His career spanned the development of cinema, from silent film, through early experiments in Technicolor to filmmaking in the 21st century.<This sample></p></BODY></HTML>
结果:
<HTML><BODY><p style="margin:0px">His <span style="color: rgb(237, 23, 23);">career </span>spanned the development of cinema, from <span style="font-weight: 700;">silent film</span>, through early experiments in <span style="text-transform: uppercase;">Technicolor </span>to filmmaking in the 21st century.</p><p>His career spanned the development of cinema, from silent film, through early experiments in Technicolor to filmmaking in the 21st century.<This sample></p></BODY></HTML>
感谢
Iyyappan小号
您使用哪种语言?如果你使用PHP,你可以使用'htmlentities'来编码所有特殊字符。 – Barmar
我在flex中使用动作脚本3.0。 –
https://stackoverflow.com/q/2342453/570812 – Passerby