Deal with HTML where ' is used instead of "
Cut off name from option
This commit is contained in:
parent
b5f493c55a
commit
0f0aaf51e0
@ -28,11 +28,11 @@ sub namevalue {
|
||||
my ($tag)=@_;
|
||||
my $name=$tag;
|
||||
if($name =~ /name *=/i) {
|
||||
if($name =~ /name *= *([^\"]([^ \">]*))/) {
|
||||
if($name =~ /name *= *([^\"\']([^ \">]*))/) {
|
||||
$name = $1;
|
||||
}
|
||||
elsif($name =~ /name *= *\"([^\"]*)\"/) {
|
||||
$name=$1;
|
||||
elsif($name =~ /name *= *(\"|\')([^\"\']*)(\"|\')/) {
|
||||
$name=$2;
|
||||
}
|
||||
else {
|
||||
# there is a tag but we didn't find the contents
|
||||
@ -46,12 +46,12 @@ sub namevalue {
|
||||
}
|
||||
# get value tag
|
||||
my $value= $tag;
|
||||
if($value =~ /value *=/i) {
|
||||
if($value =~ /value *= *([^\"]([^ \">]*))/) {
|
||||
if($value =~ /[^\.a-zA-Z0-9]value *=/i) {
|
||||
if($value =~ /[^\.a-zA-Z0-9]value *= *([^\"\']([^ \">]*))/) {
|
||||
$value = $1;
|
||||
}
|
||||
elsif($value =~ /value *= *\"([^\"]*)\"/) {
|
||||
$value=$1;
|
||||
elsif($value =~ /[^\.a-zA-Z0-9]value *= *(\"|\')([^\"\']*)(\"|\')/) {
|
||||
$value=$2;
|
||||
}
|
||||
else {
|
||||
# there is a tag but we didn't find the contents
|
||||
@ -91,7 +91,7 @@ while($in =~ /[^<]*(<[^>]+>)/g ) {
|
||||
$method="get"; # default method
|
||||
}
|
||||
$action= $tag;
|
||||
$action=~ s/.*action *= *(\"|)([^ \">]*).*/$2/gi;
|
||||
$action=~ s/.*action *= *(\'|\"|)([^ \"\'>]*).*/$2/gi;
|
||||
|
||||
$method=uc($method);
|
||||
|
||||
@ -138,14 +138,14 @@ while($in =~ /[^<]*(<[^>]+>)/g ) {
|
||||
($name, $value)=namevalue($tag);
|
||||
|
||||
if($mtag =~ /select/i) {
|
||||
print "Select: $name\n";
|
||||
print "Select: NAME=\"$name\"\n";
|
||||
push @vars, "$name";
|
||||
$select = 1;
|
||||
}
|
||||
else {
|
||||
$type=$tag;
|
||||
if($type =~ /type *=/i) {
|
||||
$type =~ s/.*type *= *(\"|)([^ \">]*).*/$2/gi;
|
||||
$type =~ s/.*type *= *(\'|\"|)([^ \"\'>]*).*/$2/gi;
|
||||
}
|
||||
else {
|
||||
$type="text"; # default type
|
||||
@ -176,7 +176,7 @@ while($in =~ /[^<]*(<[^>]+>)/g ) {
|
||||
($tag =~ /^< *textarea/i)) {
|
||||
my ($name, $value)=namevalue($tag);
|
||||
|
||||
print "Textarea: $name\n";
|
||||
print "Textarea: NAME=\"$name\"\n";
|
||||
}
|
||||
elsif($select) {
|
||||
if($tag =~ /^< *\/ *select/i) {
|
||||
@ -185,7 +185,11 @@ while($in =~ /[^<]*(<[^>]+>)/g ) {
|
||||
}
|
||||
elsif($tag =~ /[^\/] *option/i ) {
|
||||
my ($name, $value)=namevalue($tag);
|
||||
print " One option (name \"$name\") = \"$value\"\n";
|
||||
my $s;
|
||||
if($tag =~ /selected/i) {
|
||||
$s= " (SELECTED)";
|
||||
}
|
||||
print " Option VALUE=\"$value\"$s\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user