RegExp to find any symbols outside XML tag

In my React project I have a string like this:

<App>ew <View id="view1" visible="true">4</View>- <View id="view1" visible="true" width="100">WORD</View>s</App>

and I’m trying to remove any symbols and words outside tags even if the document is valid XML.

The result should be like this:

<App><View id="view1" visible="true"></View> <View id="view2" visible="true" width="100"></View></App>

May be there’s another way without using RegExp, I’d appreciate any help

5 thoughts on “RegExp to find any symbols outside XML tag”

  1. 156778 904580Oh my goodness! an excellent post dude. Numerous thanks However We are experiencing dilemma with ur rss . Dont know why Not able to sign up to it. Could there be anybody getting identical rss dilemma? Anyone who knows kindly respond. Thnkx 685161


Leave a Comment