Perl regular expression does not work on 5.8.0

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Perl regular expression does not work on 5.8.0

    Good afternoon,

    we have a perl regular expression which always worked for us on
    Solaris(SPARC) HPUX(IA64) and Debian GNU/Linux(i386). But now I have to
    install a software on a RedHat based GNU/Linux i386 box and the same
    expression does not work any longer.

    See the following script:

    ----------------------------------------------------------
    #!/usr/bin/perl

    print "Enter lines with 'key = value'\n";

    while ( <STDIN> ) {
    if ( /^\s*([^\s=]+)\s*=\s*([^\"]\S*|\".*\")\s*/ ) {
    print "Match! key = '$1', value = '$2'\n";
    }
    else {
    print "No match.\n";
    }
    }
    ----------------------------------------------------------

    On Debian (Woody) with Perl 5.6.1 it works, it matches lines like

    a = b

    On HPUX(IA64) with Perl 5.8.0 it works as well. On RedHat 9 with Perl
    5.8.0 however, it does not match at all.

    What am I doing wrong?

    Any help is appreciated!

    Regards,
    Stefan


    --
    Stefan Rupp Phone: +49 (0) 2408 9456-44
    Inform GmbH Fax: +49 (0) 2408 9456-45
    Pascalstr. 23, 52076 Aachen, Germany E-Mail: [email]stefan.rupp@inform-ac.com[/email]

    Stefan Rupp Guest

  2. Similar Questions and Discussions

    1. Regular Expression
      Hi, I am writing a script that parses an html file (which has been retrieved as a scalar by LWP::UserAgent). The script looks for everything in...
    2. Regular expression bug?
      All of CF's RE functions act in a weird way, contrary to the documentation (both CF's own, and the underlying Java Regex docs). The special...
    3. Perl regular expression
      Need a pattern to find string and words between braquets ???
    4. Perl program need in regular expression
      I want a program can read a log file and capture the character seg=9543 The file log line like this ...
    5. Regular Expression....?
      Hi I am looking for the regular expression for validating the allowed file types to upload like files like "zip,pdf,doc,rtf,gif,jpg,png,txt"; and...
  3. #2

    Default Re: Perl regular expression does not work on 5.8.0

    "Stefan Rupp" <stefan.rupp@inform-ac.com> wrote:
    > if ( /^\s*([^\s=]+)\s*=\s*([^\"]\S*|\".*\")\s*/ ) {
    Hi,

    in some circumstances the [^\s] doesn't work in the standard
    distribution of perl shipped with redhat 9, due to some utf8
    bug. Upgrading your perl version or disabling utf8 support
    for your locale should solve this.

    HTH
    -Christian




    Christian Winter Guest

  4. #3

    Default Re: Perl regular expression does not work on 5.8.0

    Good evening,

    Thanks for the answer!

    Christian Winter schrieb:
    > in some circumstances the [^\s] doesn't work in the standard
    > distribution of perl shipped with redhat 9, due to some utf8
    > bug. Upgrading your perl version or disabling utf8 support
    > for your locale should solve this.
    How do I 'disable utf8 support' in RH 9? I'm more used to Debian, so
    I'm unfamiliar with 'The RedHat way'.

    The other option, to update perl, would be to go to perl 5.8.1 beta,
    which I'd rather avoid. I'd need libdb-4.1.so for that as well.

    Regards,
    Stefan

    Stefan Rupp Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139