diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-12-05 12:54:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-12-05 12:54:08 +0000 |
commit | 081e5a82ffc8f4002861d31741e31837f96d3d54 (patch) | |
tree | fa7b2f8365ffa3bf36c80d66931f900f763c0209 /perl | |
parent | 2ad2a4bd9fb4dc5ef25f9291591174c0fccc0938 (diff) | |
download | curl-081e5a82ffc8f4002861d31741e31837f96d3d54.tar.gz |
deal with spaces in name and value tags a lot better!
Diffstat (limited to 'perl')
-rwxr-xr-x | perl/contrib/formfind | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/perl/contrib/formfind b/perl/contrib/formfind index 4425e6e9b..f3f3d414e 100755 --- a/perl/contrib/formfind +++ b/perl/contrib/formfind @@ -28,7 +28,17 @@ sub namevalue { my ($tag)=@_; my $name=$tag; if($name =~ /name *=/i) { - $name=~ s/.*name *= *(\"|)([^ \">]*).*/$2/gi; + if($name =~ /name *= *([^\"]([^ \">]*))/) { + $name = $1; + } + elsif($name =~ /name *= *\"([^\"]*)\"/) { + $name=$1; + } + else { + # there is a tag but we didn't find the contents + $name="[weird]"; + } + } else { # no name given @@ -37,7 +47,16 @@ sub namevalue { # get value tag my $value= $tag; if($value =~ /value *=/i) { - $value=~ s/.*value *= *(\"|)([^ \">]*).*/$2/gi; + if($value =~ /value *= *([^\"]([^ \">]*))/) { + $value = $1; + } + elsif($value =~ /value *= *\"([^\"]*)\"/) { + $value=$1; + } + else { + # there is a tag but we didn't find the contents + $value="[weird]"; + } } else { $value=""; @@ -142,11 +161,11 @@ while($in =~ /[^<]*(<[^>]+>)/g ) { push @alts, "$value"; } else { - $info=""; + print "Input: NAME=\"$name\""; if($value ne "") { - $info="=$value"; + print " VALUE=\"$value\""; } - print "Input: $name$info ($type)\n"; + print " ($type)\n"; push @vars, "$name"; # store default value: $value{$name}=$value; |