This is probably a no brainer for you guys but i just can't wrap my head around the whole regex thing... I'm parsing an html document and i need to extract content between two tags so if i have in the page <b class="CPprodDescDet">lorem ipsum</b> it should just return "lorem ipsum".
this is what i have so far, but it's returning the whole thing (<b class...):
/^<b class="CPprodDescDet"> .*? <\/b>$/
what am i doing wrong?
is there a better way to do it?
dummy help
Moderator: General Moderators
Re: dummy help
Try this:
Code: Select all
$text = preg_replace("#<b class=\"CPprodDescDet\">(.*?)</b>#is", "$1", $the_string);Re: dummy help
that works great, thanks alot.