in reply to Re: Which one is the better Regex?
in thread Which one is the better Regex?

Ok ... i've to write better regex ;o) btw i'm newbie to this topic. do you have e.g. for both things?

thx

Replies are listed 'Best First'.
Re: Which one is the better Regex?
by Abigail-II (Bishop) on Feb 27, 2003 at 14:30 UTC
    As I said, you have to PARSE the HTML text - you shouldn't attempt to solve it with a single regex.

    Abigail

Re: Re: Re: Which one is the better Regex?
by PodMaster (Abbot) on Feb 28, 2003 at 07:45 UTC
    Check out YAPE::HTML -- It is pure perl (ie regexes)
    #!/usr/bin/perl use YAPE::HTML; use Data::Dumper; use warnings; use strict; my $content = " <html> <title> yes a title </title> <body> yes a body </body> </html> "; my $parser = YAPE::HTML->new($content); my $extor = $parser->extract( 'title' => []); while (my $chunk = $extor->()) { print Dumper $chunk; print $/,'>>>>',$chunk->text()->[0]->string(),'<<<<',$/x5; } __END__ $VAR1 = bless( { 'TYPE' => 'tag', 'ATTR' => {}, 'TAG' => 'title', 'TEXT' => [ bless( { 'TYPE' => 'text', 'TEXT' => ' yes a title ' }, 'YAPE::HTML::text' ) ], 'IMPLIED' => '', 'CLOSED' => 1 }, 'YAPE::HTML::tag' ); >>>> yes a title <<<<


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.