ScottGor has asked for the wisdom of the Perl Monks concerning the following question:

Hi all! Im hoping someone can give me some tips. I have a script that searches files based on a string query entered by the user. Works great until someone searches for a string conatining a omulate. For instance, the german word "möchten" returns nothing, even though I have a file containing the word. Ive tried switching my Locale to german.

use POSIX qw(locale_h);
setlocale(LC_CTYPE, "de_DE.ISO8859-1");

then remove leading/trailing whitespace from string like always...

$containingText =~ s/^\s*(.*?)\s*$/$1/;
$newline = $/;
$/ = undef;

but still no dice. So, Im thinking my regex isnt setup to handle foreign character classes correctly. Im new to Perl and have done alot of web searching. Havent found anything yet to help. This script is to support five languages, german, italian etc. So Ive had my admin load all the Locales on the server (AIX). Any links, snippets, or even a smack in the forehead is appreciated.

Replies are listed 'Best First'.
Re: Regex help for string file search
by Roy Johnson (Monsignor) on Jun 17, 2004 at 16:20 UTC
    This recent thread may help you out.

    We're not really tightening our belts, it just feels that way because we're getting fatter.
      Thanks for the response, although its not apparant how that post can help me, except for lowercase upper case string substitution. Am I missing something?
        If you haven't turned on the use locale; pragma, you should at least give it a shot. Also note that version 5.6 was a problem, while 5.8 was not. What version of Perl are you running?

        We're not really tightening our belts, it just feels that way because we're getting fatter.