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

I ran into trouble when trying to match my scandinavian characters åäö using \w in a regexp. I wrote a shorter test script like this:
use warnings; use strict; use locale; if ("ö" =~ /\w/) { print "^_^\n"; } else { print "T_T;\n"; }
On second thought this could maybe be more of a linux question though, I tried running the script encoded as latin-1 on both my ubuntu and windows PC and it ran fine on windows but not linux. So where would I go to resolve it?

Replies are listed 'Best First'.
Re: Matching non-ascii chars with \w in regexps
by shmem (Chancellor) on Jul 21, 2006 at 09:13 UTC
    Check your locale setting. It could be some UTF-8.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}