Using Find/Replace - Do I need to use Regular Expressions?

Questions about XML that are not covered by the other forums should go here.
Douha
Posts: 17
Joined: Fri Aug 19, 2005 6:02 pm

Using Find/Replace - Do I need to use Regular Expressions?

Post by Douha »

Hi All,

I have a need to do a mass replace on a certain tag in an xml file.

I need to replace the value in a tag from whatever it is to a null.

For example, I have an element with the following tags.

<tag1 Attribute="Y"><![CDATA[41]]></tag1>.

The cdata section for this tag through out the whole file can contain many different values. I need to change them all to null regardless of the current value.

Can anyone point me in the right direction? I have done some searching on the web for perl regular expressions because that is what the user guide says oXygen uses for it's regular expressions.

What I am seeing at the moment isn't helping me much.

Thanks,

Doug
State of Utah
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

Check the option Regular expression in the Find/Replace dialog, enter <tag1(.*?)>(.*?)<!\[CDATA\[(.*?)\]\]>(.*?)</tag1> in the Text to find area and enter <tag1$1>$2<![CDATA[]]>$4</tag1> in the Replace with area. The find and replace operations will remove only the content of the CDATA section from tag1 elements. For example it will replace <tag1 Attribute="Y"> abc <![CDATA[41]]> def </tag1> with <tag1 Attribute="Y"> abc <![CDATA[]]> def </tag1>.


Regards,
Sorin
Post Reply