my $regex1 = '(hello)'; my $test = 'hello there'; if ($test =~ /$regex1/) { print "$1\n"; }