NYCPHP Meetup

NYPHP.org

Help with regex

Nestor Florez nestorflorez at earthlink.net
Fri May 16 11:26:26 EDT 2003


Hi people,

I am having problems doing a regex using ereg_replace
I am reading a file and when I find a line with  white space and <td width=123>
I want to remove these characters up to an including the '>'.
This is what a typical line looks like:
-----------------------------------------
   <td width="49">205</td>
   <td width="155">Asaro, Doreen</td>
   <td width="197">G.I.S.</td>
   <td width="42">&nbsp;</td>
----------------------------------------------

I have tried the following but it does not work
------------------------------------------
foreach($content as $line)
{
 $line = ereg_replace(".*>", "", $line);
 print "$i = $line <br>";
 $i++;
}
------------------------------------------

I also tried :
$line = ereg_replace(".*?>", "", $line);
To make sure that it does not remove the entire line when it finds the '>' in  "</td>"
but I get this error:
*Warning*: ereg_replace() [function.ereg-replace <http://www.php.net/function.ereg-replace>]: REG_BADRPT: in *c:\\program files\\apache group\\apache\\htdocs\\php\\readphone.php* on line *35*

Any ideas?

Thanks,

Nestor



More information about the talk mailing list