$a="http://www.stackoverflow.com/yyyyyyyyyyyyyyyy"; if($a=~/\/\/\w+\.(.*)\// ) { print $1; } else { print "false"; }