Regular expression to match “>”, “<”, “&” chars that appear inside XML nodes

前端 未结 7 2110
栀梦
栀梦 2020-12-19 02:42

I\'m trying to write a regular expression using the PCRE library in PHP.

I need a regex to match only &, > and < cha

7条回答
  •  情话喂你
    2020-12-19 02:59

    Classic example of garbage in, garbage out. The real solution is to fix the broken XML exporter, but obviously that's out of the scope of your problem. Sounds like you might have to manually parse the XML, run htmlentites() on the contents, then put the XML tags back.

提交回复
热议问题