in reply to Re: Re: Regex simplification
in thread [untitled node, ID 192753]

print $1 if $line =~ m/<!-- USER \d+ - ([^\s]+)/i;
This is good, but it \S is shorter than [^\s], so:
print $1 if $line =~ m/<!-- USER \d+ - (\S+)/i;
Although to get a little closer to the original specification, I'd put:
my $user=undef; for (@site) { if (/<!--.*USER.* (\S+) -->/) { print "joe:\n"; $user = $1; last; } } print "user = $user\n";