Reply to Re: [PHP] Removing all <tr> tag

Your name:

Reply:


Posted by Christophe Chisogne on 01/06/05 12:30

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)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация