#This works my $s = "This is a test"; my $rex = qr/test/i; print "yep\n" if($s =~ $rex); #How do I do this? $rexSubstitution = qr/test/TEST/i; $s =~ $rexSubstitution;