NYCPHP Meetup

NYPHP.org

regex help

Nestor nestorflorez at earthlink.net
Mon May 19 00:20:05 EDT 2003


Thanks to all forthe regex help
I actualy was trying to accomplish this in PHP but
I ended up doing it in perl.  It was easier reading the file
itself.

 $_ =~ s/.*[^>]+>(.*[^<])<\\/td>/\\1/gi;

Thanks again,

nestor :-)

-----Original Message-----
From: Ovid [mailto:poec at yahoo.com]
Sent: Friday, May 16, 2003 8:57 AM
To: Dennis Stout; Nestor Florez; beginners-cgi at perl.org
Cc: nflorez at guhsd.net
Subject: Re: regex help


--- Dennis Stout <stout at stout.dyndns.org> wrote:
> Or this:
>
> $_ = s/<td .*>(.*)<\\/td>//gi;

Comments:

1.  The binding operator (=~) should be used.
2.  If $_ is used, then it's redundant and can be omitted.
3.  It's broken.  The following demonstrates:

  $_ = '<td width="10">this</td><td with="10">that</td>';
  s/<td .*>(.*)<\\/td>//gi;
  print $1;

Cheers,
Ovid

=====
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/
Silence Is Evil
http://users.easystreet.com/ovid/philosophy/indexdecency.htm

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

--
To unsubscribe, e-mail: beginners-cgi-unsubscribe at perl.org
For additional commands, e-mail: beginners-cgi-help at perl.org

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.476 / Virus Database: 273 - Release Date: 4/24/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.476 / Virus Database: 273 - Release Date: 4/24/2003




More information about the talk mailing list