develooper Front page | perl.perl5.porters | Postings from November 2010

Re: [perl #80030] Matching upper ASCII characters from file in RE patterns

Thread Previous | Thread Next
From:
Eric Brine
Date:
November 30, 2010 18:26
Subject:
Re: [perl #80030] Matching upper ASCII characters from file in RE patterns
Message ID:
AANLkTimCgLsCROB=gwAnuP74PGFfyekZLd9+KtANZQKA@mail.gmail.com
On Tue, Nov 30, 2010 at 4:57 PM, Jonathan Pool <perlbug-followup@perl.org>wrote:

> # New Ticket Created by  Jonathan Pool
> # Please include the string:  [perl #80030]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=80030 >
>
>
> The attached script unibug.pl, which reads from the attached file
> unibug.txt, demonstrates a problem in Perl 5.10.0 which Karl Williamson says
> is still present in 5.13.7.
>
> It matches the input line against 7 regular-expression patterns, 1-7.
> Patterns 3 and 7 should fail to match; the others should match.
>
> However:
>
> With "use utf8", pattern 3 matches instead of failing.
>

Bad test

    print ('3. The NBS is ' . (/[\7f-\x80]/ ? '' : 'NOT ') . 'matched by
/[\7f-\x80]/' . "\n");

should be

    print ('3. The NBS is ' . (/[\x7f-\x80]/ ? '' : 'NOT ') . 'matched by
/[\7f-\x80]/' . "\n");


> With "use encoding 'utf8'" (or with both pragmas), [...] patterns 4, 5, and
> 6 fail instead of matching.
>

I'm not sure if that's a bug, or if it's broken by design.

- Eric

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About