in reply to simple regex

I find that "simple regex" and HTML very rarely fit nicely together!

You can never be sure what the HTML will actually look like as ptum mentions above. If your HTML is part of a file it would be well worth considering a parser.

#!/bin/perl5 use strict; use warnings; use HTML::TokeParser::Simple; my $html = '<input type="hidden" name="VERIFIER" value="076-62">'; my $attribute = 'value'; my $value; my $tp = HTML::TokeParser::Simple->new(\$html) or die "Couldn't parse string: $!"; while (my $t = $tp->get_token) { if ( $t->is_start_tag('input') and $value = $t->get_attr($attribute) ) { print "*$value*\n"; } }