U question was : Everything __between something___ becomes an array element
What is wrong with answer : tag[1]= <td><table><tr><td>foo</td><td>bar</td></tr></table> tag[2]= <td>foo</td><td>bar</td> :-))) AK>-----Original Message----- AK>From: Andrey Hristov [mailto:[EMAIL PROTECTED]] AK>Sent: Tuesday, November 06, 2001 5:18 PM AK>To: [EMAIL PROTECTED] AK>Cc: [EMAIL PROTECTED] AK>Subject: Re: [PHP] Everything between something becomes an array element AK> AK> AK>But .... watch this... AK><body> AK><table><tr><td><table><tr><td>foo</td><td>bar</td></tr></table></ AK>tr></table> AK><table><tr><td>foo bar</td></tr></table> AK></body> AK> AK>I think that the return result will be AK><tr><td><table><tr><td>foo</td><td>bar</td></tr></table></tr></table> AK><table><tr><td>foo bar</td></tr> AK> AK>Why? Beacuse you set PCRE to be greedy. I think that there is no AK>easy way to AK>solve the problem with nested <tr> tags. AK> AK>Regards, AK> AK>Andrey Hristov AK>Web Developer AK>Icygen Corporation AK>BUILDING SOLUTIONS AK>http://www.icygen.com AK> AK> AK>On Tuesday 06 November 2001 02:57 am, you wrote: AK>> Here is right implememtation of all i see AK>> AK>> <? AK>> $co=0; AK>> $str="<tr><td><table><tr><td>foo</td><td>bar</td></tr></table></tr>"; AK>> echo "<pre>"; AK>> GetTagElements($str); AK>> echo "</pre>"; AK>> AK>> function GetTagElements($str) AK>> { AK>> global $co; AK>> if ($co++){echo "tag[".($co-1)."]= ".htmlentities($str)."<br>";} AK>> AK>> AK>> AK>$how=preg_match_all('~\<tr\>(.*)<\/tr\>~',$str,$var_match,PREG_SE AK>T_ORDER); AK>> if ($how) AK>> for ($i=1;$i<count($vr=$var_match[0]);$i++) AK>> { AK>> GetTagElements($vr[$i]); AK>> } AK>> else return 0; AK>> } AK>> AK>> ?> AK>> AK>> > -----Original Message----- AK>> > From: Andrey Hristov [mailto:[EMAIL PROTECTED]] AK>> > Sent: Monday, November 05, 2001 11:13 PM AK>> > To: [EMAIL PROTECTED] AK>> > Subject: Re: [PHP] Everything between something becomes an AK>array element AK>> > AK>> > AK>> > Sorry AK>> > AK>> > $how=preg_match_all('|\<tr>(.*?)</tr\>|',$the_big_string,$matches, AK>> > PREG_SET_O AK>> > RDER); AK>> > AK>> > is the correct I think AK>> > AK>> > Excuses AK>> > AK>> > On Monday 05 November 2001 08:57 am, you wrote: AK>> > > It gives me an error....: AK>> > > AK>> > > Warning: Compilation failed: nothing to repeat at offset 7 in AK>> > > c:\www\innocenti\teste.php on line 17 AK>> > > AK>> > > I think that 'offset' is like a letter from the regex, but I AK>> > AK>> > could not fix AK>> > AK>> > > it... AK> AK>-- AK> AK>-- AK>PHP General Mailing List (http://www.php.net/) AK>To unsubscribe, e-mail: [EMAIL PROTECTED] AK>For additional commands, e-mail: [EMAIL PROTECTED] AK>To contact the list administrators, e-mail: [EMAIL PROTECTED] AK> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]