regular expression

From: Date: Wed, 19 Dec 2001 16:08:22 +0000
Subject: regular expression
Groups: php.general 
Request: Send a blank email to php-general+get-78221@lists.php.net to get a copy of this message
Hi, Can you help me on this simple regexp? I've this string: $testata = "<tr bgcolor=\"#FF9900\" valign=\"middle\"><td colspan=\"2\" align=\"center\" height=\"11\"><div align=\"left\" class=\"titoliblu\">NEWS A ROTAZIONE</div></td><td class=\"titolipiccolibianchi\" align=\"center\" height=\"11\" width=\"10%\">cancella</td></tr>"; and this eregi: eregi("^<tr(.*)>(.*)</tr>$",$header,$regs); In this way I'd like to obtain the properties of the row (ie: bgcolor=\"#FF9900\" valign=\"middle\") and all the columns in the row (the content of each pair <td>...</td>). I'm expecting to have this: in $reg[1]: bgcolor=\"#FF9900\" valign=\"middle\" in $reg[2]: <td colspan=\"2\" align=\"center\" height=\"11\"><div align=\"left\" class=\"titoliblu\">NEWS A ROTAZIONE</div></td><td class=\"titolipiccolibianchi\" align=\"center\" height=\"11\" width=\"10%\">cancella</td> Instead I''ve this: $reg[1]: bgcolor=\"#FF9900\" valign=\"middle\"><td colspan=\"2\" align=\"center\" height=\"11\"><div align=\"left\" class=\"titoliblu\">NEWS A ROTAZIONE</div></td><td class=\"titolipiccolibianchi\" align=\"center\" height=\"11\" width=\"10%\">cancella</td ie the last ">" was found, but I'd like the FIRST one!! Can someone give me a solution? Thanks, Carlo

« previous php.general (#78221) next »