Hello, i'm still quite new to using regex in php and i've got stuck on something that i think should be pretty styraightforward.
I'm trying to transform a line of XML like this...
<Dload url=\"www.mysite.com/file.zip\"><![CDATA[Click to download the zipped file]]></Dload>
into a line of html like this...
<p><a href="www.mysite.com/file.zip">Click to download the zipped file</a></p>
Here's my attempt (the pattern doesn't match), i'm unclear about how i should be escaping characters in the pattern and replacement strings..
$pattern="<Dload url=\"([^\"]*)\"><![CDATA\[([^\]]*)]]></Dload>"; // format dload links
$replacement="<p><a href=\"\\\1\">\\\2</a></p>";
$datastring = ereg_replace ($pattern, $replacement, $datastring);
can anyone give me a hand?