my $str = "Hello my name is Kevin"; my $regex = $form->query(...); #Value of regex : "/Hello\smy\name\sis\s(\w.*)/" $str =~ $regex;