Binoy AV a écrit :
Hi,
I have an html file containing a table. I applied
eregi("<TR>.*</TR>",$contents,$temp) through my Php.I am getting
> (...)
The code removing only the first and last <(/)tr>.
Expected behaviour : regex are 'greedy', ie
the .* matches the longuest string possible
How to do it using eregi ?
Use preg_* functions (Perl regex are more powerfull and faster)
ex (not tested)
$temp = preg_replace('/<tr>(.*?)<\\/tr>/', '$1', $content);
PS the '?' in '.*?' means previous modifier (*) is not greedy
(Perl re syntax, man perlre)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php