in reply to Re^2: Compiled regular expression using qr
in thread Compiled regular expression using qr
In the OP and in your reply above, you use the terms "exact" and "case insensitive" in the context of regex matching in a way that leads me to wonder if you understand that case insensitive matching is inherently inexact. E.g.:
c:\@Work\Perl>perl -wMstrict -le "my $rx = qr/^data_123$/i; print $rx; ;; for my $s (qw(data_123 DATA_123 dAtA_123 data_123x data_12 nada_123) +) { if ($s =~ $rx) { print qq{'exact' match to '$s'}; } else { print qq{NO match to '$s'}; } } " (?^i:^data_123$) 'exact' match to 'data_123' 'exact' match to 'DATA_123' 'exact' match to 'dAtA_123' NO match to 'data_123x' NO match to 'data_12' NO match to 'nada_123'
Update: I should have mentioned that the example above was run under Strawberry Perl version 5.14.4.1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Compiled regular expression using qr
by perlbaski (Sexton) on Oct 15, 2014 at 22:32 UTC | |
by AnomalousMonk (Archbishop) on Oct 15, 2014 at 23:54 UTC | |
by ikegami (Patriarch) on Oct 15, 2014 at 23:05 UTC |