in reply to Creating a regex to match part of a URL's domain name (was: pattern matching)

This matches the longest string of word characters that is followed by '.com',

my $domain; if ($str =~ /(\w+)\.com/) { $domain = $1; } else { # no match $domain = ''; }
--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me