Build up your regular expression programatically, and use the (?i-xsm) or (?-xism) constructs (documented in perlre).
In other words....
my $insensitive = '(?i-xsm)'; my $sensitive = '(?-xism)'; my $target = "Abcde"; foreach my $re_switch ( $insensitive, $sensitive ) { if( $target =~ m/$re_switch([a-z])/ ) { print "$1\n"; } }
And the output...
A b
Dave
In reply to Re: How do I change substitution options within a program?
by davido
in thread How can I change substitution options within a program?
by b2sing4u
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |