View Single Post
  #1 (permalink)  
Old 05-20-2008, 04:35 PM
John_L John_L is offline
Newbie
 
Join Date: May 2008
Posts: 10
Credits: 0
Rep Power: 0
John_L is on a distinguished road
Default Regex Expressions

Just started using regex expressions but i'm stumped when it comes to the following. I'm parsing data and I want to strip away the following tag found in xml files but leave the text it surrounds intact.

<![CDATA[ text ]]>

It's the text inside I would like to keep. I tried searching the net for the proper way but all i've come up with is a way to strip the tag along with what is contained inside it. If I break up my single expression into two and looking it as two regex substitution calls, I get compile time errors...Thanks in advance.

what I have now, that strips away the tag and what's inside it...

$string =~ s/<![CDATA[]]//i; #substitute it with nothing (strip it away)
Reply With Quote

Sponsored Links