in reply to Problem matching non-english chars
Normally that's not the case, but if you use locales, you can force Perl to think of the characters that way. Regular expressions and case-modification functions are some of the functions modified by using locales, so you could use your case-insensitive regexp, or you could use functions like lc and uc on your strings, then do the comparison.
For example, I tried this on my local system. It's going to be different on yours, most likely, but this may give you the general idea:
So, for me, the locale I set was "sv" (Sweden); this may differ slightly for you, as apparently the names aren't very standardized. perllocale suggests the following command lines to find the locale list:use locale; use POSIX qw/locale_h/; setlocale(LC_CTYPE, "sv"); my $search_str = "gläd"; my $item_str = "GLÄD"; if ($item_str =~ /^$search_str$/i) { print "Matched!"; }
Some of these probably won't work, but hopefully, some will.locale -a nlsinfo ls /usr/lib/nls/loc ls /usr/lib/locale ls /usr/lib/nls
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Problem matching non-english chars
by Guano (Initiate) on Apr 20, 2000 at 11:14 UTC |