0

I'm getting problems with my coding. I'm trying to take out tags from my preg_match_all. I'm still new and learning.

preg_match_all("/\<b>\\$(.*?)\<\/b\>/is", $res[0], $Price );
for($i = 0; $i < count($Price); $i++) {
    $Price = preg_replace("/<.*?>/is","",$Price);   

}
foreach($Price[0] as $kgbPrice) 
{
    $PriceArray[] = "<div class='prices' id='kgbdealsPrice'>".$Price."</div>";
}

The array is being outputted somewhere else.

I'm getting content which has

<b>content</b>

Thank you

hellomello
  • 8,219
  • 39
  • 151
  • 297
  • [don't parse html with regular expressions](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – ax. Mar 17 '11 at 06:11
  • Are you trying to actually capture what's inside your tags, or just trying to strip out the tags altogether? If it's the latter, you could use strip_tags(), which lets you specify a list of acceptable tags: [http://www.php.net/manual/en/function.strip-tags.php] – dearlbry Mar 17 '11 at 06:14
  • Yeah, this I posted this before I discovered SIMPLEHTMLDOM. That definitely was a much simpler solution. – hellomello Mar 18 '11 at 18:39
  • @andrewliu consider marking this question as resolved (green tick) – Stephan Mar 31 '11 at 21:52
  • Hello, I'm not sure where to mark as solved? – hellomello Mar 31 '11 at 22:03
  • i have posted an answer with your solution. Just click on the tick under the answer vote count. – Stephan Apr 02 '11 at 22:29

1 Answers1

1

SIMPLEHTMLDOM has been used by andrewliu for solving his problem. It was a much simpler solution.

Stephan
  • 41,764
  • 65
  • 238
  • 329