in reply to Counting HTML form elements with a regular expression

PHP has Perl-compatible regex support, so this isn't quite as stupid a request as one might think. In answer to your problem, what you need is a nested regex - one level to get the tag, the next to parse the various parts. You could do it something like this:
use strict; use warnings; my ($text, $tag, %tag, %c); $text = join '', <DATA>; while ($text =~ /<input (.*?)>/g) { $tag = $1; while ($tag =~ /(\w+)="(.*?)"/g) { $tag{lc($1)} = $2; } $c{"$tag{type}$tag{name}"} = 1; } for (sort keys %c) { print "$_\n"; } print scalar keys %c; __DATA__ <input type="radio" name="booger" value="bingo"> <input type="radio" name="booger" value="bongo"> <input type="radio" name="snot" value="bingo">
Note - this may be unforgiving to some forms of sloppily coded HTML, but it should give you the general idea of how to go about parsing your form fields. I'd write you a PHP version too, but I need sleeeeeep...