regexp problem with UTF8

Discussion in 'Perl Misc' started by Risto Vaarandi, Jul 16, 2003.

  1. hi,

    I have a perl program that has worked for 2 years on redhat and solaris
    nodes without problems. Recently I moved it to a redhat9 node (which has
    utf8 as default system character set), and discovered that the following
    regular expression inside the program does not work:

    if ($line =~ /^\s*([^=\s]+)\s*=\s*(.*\S)/) {
    $keyword = $1;
    $value = $2;
    }

    When the regexp is written as /^\s*(\w+)\s*=\s*(.*\S)/, or as
    /^\s*([^=]+)\s*=\s*(.*\S)/ , everything works fine. What could be the
    problem here? (When I change the system charset from UTF8 to iso8859-1,
    it works.)

    br,
    risto
    Risto Vaarandi, Jul 16, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wes Groleau

    utf8 in regexp (perl 5.8.1)

    Wes Groleau, Apr 11, 2005, in forum: Perl
    Replies:
    1
    Views:
    2,957
    Wes Groleau
    Apr 12, 2005
  2. Greg Hurrell
    Replies:
    4
    Views:
    151
    James Edward Gray II
    Feb 14, 2007
  3. Joao Silva
    Replies:
    16
    Views:
    342
    7stud --
    Aug 21, 2009
  4. gry
    Replies:
    2
    Views:
    706
    Alf P. Steinbach
    Mar 13, 2012
  5. Jochen Lehmeier

    Anything to be done about utf8 regexp performance?

    Jochen Lehmeier, Nov 3, 2009, in forum: Perl Misc
    Replies:
    1
    Views:
    151
    Eric Pozharski
    Nov 4, 2009
Loading...

Share This Page