Problems with use locale and regexp



It is realy strange!

first the code:
#####################################
#!/usr/bin/perl

use strict;
use warnings;
use locale; ## WONT WORK
use Encode;

my $content = Encode::decode("iso-8859-15","[[lmo:Met\xE0j
alcal\xEDtt]]\n");

$content =~ s!^\[\[[a-z]{2}:.*\]\]$!!gm; ## WONT WORK
# $content =~ s!^\[\[[a-z]{2}:.*\]$!!gm; ## WORK

print $content;
#####################################

This bug? shocked me when i was parsing wikipedia-data.
after 69 articles my importprocess stops ... but he use many cpu-time
.... strange.

after some hours i found out that this small code can reproduce the
error. he cant execute the pattern.

without "use locale;" it works. With the second regexp ist works!
(search for only one \] at the end of the line).

I cant believe ... i think he must find out after "[[lmo:" that the
string dont match, why is the \]\] at the end so basic?

Why this affect only after "use locale;"? i set the locale to
POSIX,C,en_GB or de_DE, nothing :( wont work!

What is to do?

.



Relevant Pages

  • Re: Problems with use locale and regexp
    ... use locale; ## WONT WORK ... use Encode; ... locale in effect. ... That certainly is a bug and if it's still in the ...
    (comp.lang.perl.misc)
  • Re: Problems with use locale and regexp
    ... You don't say what "WONT WORK" actually means. ... locale in effect. ... That certainly is a bug and if it's still in the ... I assume you are aware that you regex doesn't match (it shouldn't ...
    (comp.lang.perl.misc)
  • Re: Problems with use locale and regexp
    ... use strict; ... use warnings; ... without "use locale;" it works. ... POSIX,C,en_GB or de_DE, nothing:(wont work! ...
    (comp.lang.perl.misc)
  • Re: [opensuse] Date display format in CLI
    ... I think we just found a bug... ... The locale is set wrong both in 11.0 and 11.2. ... Andreas Jaeger, Program Manager openSUSE, aj@ ... Twitter: jaegerandi | Identica: jaegerandi ...
    (SuSE)
  • Problem with locales in unloaded DLLs
    ... We are making a plugin (DLL) for some application. ... locale crash") didn't come up with something. ... this bug. ... I'm Schobi at suespammers dot org ...
    (microsoft.public.vc.stl)