Re: Removing all <tr> tag
| From: | Christophe Chisogne | Date: | Thu, 06 Jan 2005 10:30:50 +0000 |
| Subject: | Re: Removing all <tr> tag | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205720@lists.php.net to get a copy of this message | ||
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)