How about doing it more directly? The obvious solution seems to be to compare against /test|Test|tEst|.../. The glob function will help to create such a pattern:
use strict; use warnings; my $pat = "test"; $pat = join "|", glob join "", map { "{".uc.",".lc."}"} split //, $pat +; print "$pat\n"; for ( qw( Test test tesT tast ) ) { print "$_\n" if /$pat/; }
In reply to Re^2: making regex case insensitive
by hdb
in thread making regex case insensitive
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |