03-21-2008, 04:29 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Building an array of matches...
I want to take a page of HTML and put everything in paragraph tags into an array. So far I've failed, obviously... can this be done using a regular expression match easily enough, or is there a better way? This is the short piece of code I've been doing the test with so far;
PHP Code:
$match = "<p>test1</p> <p>test2</p>";
$worked = preg_match_all("/(\<p\>.*\<\/p\>)/", $match, $matches);
The problem is that it returns the whole string as a single match. Augh!

__________________
uʍop ǝpısdn sı ɹǝʇndɯoɔ ɹnoʎ sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
|
|
|
|