Re: help parsing HTML code

Marcel Grunauer (marcel@codewerk.com)
Wed, 31 Jan 2001 22:08:26 +0000


In message <F217Vux1Zcn8TtEvzox0000139d@hotmail.com>, "gil cohen" writes:

>You don't any of that weird stuff. All you need is a simple regex. In that 
>$res->is_sucess if, put something like:
>$content =~ m/<input type=\"text\" size=\"10\" name=\"video_fec_errors_rx\" 
>value=\"(.*?)\" READONLY>/;
>$value = $1;
>
>and now $value has what value is equal to.

Until someone decides to rearrange the parameters or make them uppercase
or forgo quotes or split them among several lines.

Better use one of the HTML parsing modules.

BTW, no need to escape the quotes in the regex. And what happens if
there is no match? Then $1 has an undefined value.

Marcel

-- 
We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
 -- London.pm strategy aka "embrace and extend" aka "mark and sweep"