April 7th, 2009, 10:31 AM
Preg_match on HTML Characters
I'm a newbie to regex and have looked up a ton of tutorials and eventually came across this forum where it looks like I may get some help.
I'm pulling in an XML feed that has HTML characters in between the xml tags. I believe it's encoding the HTML characters.
I want the content that is between these div tags.
'<div>' is coming out as '& lt;div& gt;'
For Example using: & lt;div& gt;This is my text!& lt;/div& gt;
I want simply, "This is my text!"
...but this does not seem to be working!
preg_match("/& lt;div& gt;(.*)& lt;/div& gt;/", $string, $matches);
Anyone know whats wrong or how to format the reg expression for this scenario?!
Thanks so much in advance!
April 7th, 2009, 02:13 PM