in reply to Perl HTML Form elements Filter

If you are just looking for every name=foo in the document you could use a regex like this (untested):
my @names; while(<>){ my $foo; while ($foo = /name=([^> ]*)/gi) {$foo =~ s/^"|"$//g; push @names, $f +oo} }
However using regex's to parse html is NOT advised and it is much better to use a module such as HTML::Parser.

Replies are listed 'Best First'.
Re: Re: Perl HTML Form elements Filter
by davorg (Chancellor) on Nov 28, 2000 at 13:59 UTC

    HTML::Parser is the best way to go for any kind of HTML extraction task, but there's often a subclass which is more useful for a particular task. In this case I think you'd be better off looking at HTML::TokeParser or HTML::TrreBuilder.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me