Dear all,

can someone enlighten me as to why two of the matches below fail in 5.14 onward. The only difference I see seems to be the implicitly added u modifier, which according to perlre “is not likely to be of much use to me, and so I need not worry about it very much.”

use utf8; use 5.14.0; use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 0; use Encode; binmode STDOUT, ":encoding(utf-8)"; my $s = "ä"; my @res = ( qr/\N{U+00e4}/, qr/\N{U+00e4}+/, qr/\xe4/, qr/\xe4+/, qr/[\N{U+00e4}]/, qr/[\N{U+00e4}]+/, qr/[\xe4]/, qr/[\xe4]+/, qr/ä/, qr/ä+/, qr/[ä]/, qr/[ä]+/, ); for my $re (@res) { my $m = ($s =~ $re) ? "true" : "false"; printf "%s =~ %30s == %s\n", $s, decode("UTF-8",Dumper($re)), $m; }
For me, using 5.14.2 or 5.16.0 this returns
~/perl5/perlbrew/perls/perl-5.16.0/bin/perl test.pl ä =~ qr/(?^u:\N{U+00e4})/ == true ä =~ qr/(?^u:\N{U+00e4}+)/ == true ä =~ qr/(?^u:\xe4)/ == true ä =~ qr/(?^u:\xe4+)/ == true ä =~ qr/(?^u:[\N{U+00e4}])/ == true ä =~ qr/(?^u:[\N{U+00e4}]+)/ == false ä =~ qr/(?^u:[\xe4])/ == true ä =~ qr/(?^u:[\xe4]+)/ == true ä =~ qr/(?^u:ä)/ == true ä =~ qr/(?^u:ä+)/ == true ä =~ qr/(?^u:[ä])/ == true ä =~ qr/(?^u:[ä]+)/ == false
while on 5.12.4 everything matches.

TIA!


In reply to Matching behavior with (?^u) by snoozeagain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.