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 = ''; }
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
In reply to Re: pattern matching
by davorg
in thread Creating a regex to match part of a URL's domain name (was: pattern matching)
by strfry()
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |