How can I make a case-insensitive regexp match for Russian letters?

Posted by jonny on Stack Overflow See other posts from Stack Overflow or by jonny
Published on 2010-03-30T08:15:03Z Indexed on 2010/03/30 17:33 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

I have list of catalog paths and need to filter out some of them. My match pattern is in a non-Unicode encoding.

I tried the following:

require 5.004;
use POSIX qw(locale_h);
my $old_locale = setlocale(LC_ALL);
setlocale(LC_ALL, "ru_RU.cp1251");

@{$data -> {doc_folder_rights}} = 
       grep {
              # catalog path pattern in $_REQUEST{q}
              $_->{doc_folder} =~/$_REQUEST{q}/i; 
            } 
            @{$data -> {doc_folder_rights}};

setlocale(LC_ALL, $old_locale);

What I need is case-insensitive regexp pattern matching when pattern contains russsian letters.

© Stack Overflow or respective owner

Related posts about perl

Related posts about locale