Page 1 of 1

Get all between div tags

Posted: Wed Nov 15, 2006 2:23 pm
by shiznatix
I am trying to get all of the html between 2 div tags but I am having some troubles. Here we goooooo:

Code: Select all

preg_match('#<div class="middleColumn">(.*)<\/div>#m', $cont, $matches);

dump($matches);
Obviously what I am going for is between <div class="middleColumn"> and </div> but I get no results. Any help would be grand.

Re: Get all between div tags

Posted: Wed Nov 15, 2006 2:29 pm
by Burrito

Code: Select all

preg_match('/<div class="middleColumn">(.*?)<\/div>/mi', $cont, $matches);

dump($matches);

Posted: Wed Nov 15, 2006 2:37 pm
by shiznatix
Thanks but to no avail as that did not work

Posted: Wed Nov 15, 2006 2:38 pm
by feyd

Code: Select all

#<div class="middleColumn">(.*?)</div>#si
and preg_match_all() probably.

Posted: Wed Nov 15, 2006 2:52 pm
by shiznatix
yes thank you much. success