sleeping_dragon
sleeping_dragon

Reputation: 711

Reg Ex for the following data

I have an XML data field like this

<some info></some info><Some info2></some info2><description><lot of info></description><some more info></some more info><description><info></description>

I want a regex which will remove <description>anything</description> for all the "description" tags. (there may be any arbitrary number of them)

I have to put this as a character pattern filter in Solr schema.

Upvotes: 0

Views: 58

Answers (1)

OmnipotentEntity
OmnipotentEntity

Reputation: 17131

You might get some people who will tell you either:

  1. You can't parse XML with RegEx.
  2. You should use a DOM library.

However, if all you want to do is remove things between <description> tags it should be as simple as search for <description>.*?</description> and replace with nothing.

Upvotes: 2

Related Questions