if($text =~ /($pattern)/){ print $1; #prints entire match