NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help with regex

Malcolm, Gary gmalcolm at professionalcredit.com
Fri May 16 11:45:05 EDT 2003


try  something like:

preg_replace("/\\w+<td width=\\d+>.*</td>/","",$line);

> -----Original Message-----
> From: Nestor Florez [mailto:nestorflorez at earthlink.net]
> Sent: Friday, 16 May, 2003 8:27 AM
> To: NYPHP Talk
> Subject: [nycphp-talk] Help with regex
> 
> 
> 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
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030516/0b634d43/attachment.html>


More information about the talk mailing list