hI, Just wondering if it 's possible to get all text included between for instance the <b> & </b> tags from a full page, using only 1 call to preg_match So far I can retrieve the info. if there is only one time the tags but when the page contains 2 times these tags, I can not get the right result using: preg_match("/<b>(.*)<\/b>",$html,$matches) PHP: My guess is to do it with a new function.
Did you try with the U (PCRE_UNGREEDY) search option ? This option is described here :http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php Jean-Luc
I think preg_match is for just one match isn't it? preg_match_all will give you all the matches in an array. I think you're missing a '/' at the end of the regex. It would be better to have: preg_match_all("/<b>(.*)<\/b>/siU",$html,$matches) PHP: to make it ungreedy (U) so (.*) doesn't match beyond the bold text and case-insensitive (i) should there happen to be <B></B>. Also, the s at the end will allow for line breaks. Now $matches will be an array with all the matches of bold text in $html.
yes right but so far the preg_match returns the text between the first occurence of <b> and the last occurence of </b> so it leads to the same result using preg_match_all i m looking at it
oh, i see, well the change i just added to my comment will solve that because the U makes it ungreedy.