To expand a bit on chromatic's answer: you most likely want to use locales. From reading a bit of perllocale, it looks like the "use locale" pragma changes the way certain functions and operators think about characters (and numbers, etc.). So, for example, in your case you'd want ä to be the lower-case version of Ä.

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:

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!"; }
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:
locale -a nlsinfo ls /usr/lib/nls/loc ls /usr/lib/locale ls /usr/lib/nls
Some of these probably won't work, but hopefully, some will.

In reply to Re: Problem matching non-english chars by btrott
in thread Problem matching non-english chars by Guano

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.