I have a Perl variable, $word
. I want to make a regex as follows:
$text =~ /ab($word)cd/;
I want the regex to be case sensitive for the parts ab
and cd
, but not for what is in $word
. Therefore, if $word='stack'
, I would like both of them to match:
abstackcd abStAcKcd
etc., but I do not want to match
Abstackcd
I suppose I'm looking for a way to apply /i
only to $word
, but not the rest of the expression. It can be done?
source share