Skip Menu |
Report information
Id: 131964
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
moritz.lenz [at] noris.de
xiaowei.lxw [at] alibaba-inc.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: "柯拓" <xiaowei.lxw [...] alibaba-inc.com>
To: "rakudobug" <rakudobug [...] perl.org>
Subject: [BUG] ^ and $ (also ^^ and $$) exchange their meanings wrongly in Lookbehind assertions
Date: Sun, 27 Dec 2015 23:59:33 +0800
$ perl6 -e 'say "foo".subst(/<?after ^>/, "^").subst(/<?after $>/, "\$")'
$foo^ # should be ^foo$
Subject: Regex anchors ^, ^^, $ and $$ confused in <?after>
From: Moritz Lenz <moritz.lenz [...] noris.de>
To: <rakudobug [...] perl.org>
Date: Sat, 26 Aug 2017 18:21:05 +0200
This is Rakudo version 2017.08-11-g6cec6b7 built on MoarVM version 2017.08.1-19-g151a256 implementing Perl 6.c. Rakudo confuses <?after ^> with <?after $> in a regex, and the same with ^^ and $$. The following four test cases should all pass (barring a thinko on my part), but instead they all fail: #!/usr/bin/env perl6 use Test; given "abc\ndef" { is S/ <?after ^> /X/, "Xabc\ndef", '^ in <?after>'; is S/ <?after $> /X/, "abc\ndefX", '$ in <?after>'; is S:g/ <?after ^^> /X/, "Xabc\nXdef", '^^ in <?after>'; is S:g/ <?after $$> /X/, "abcX\ndefX", '^^ in <?after>'; } done-testing Kudos go to _cronus on #perl6 for asking about a weird behavior, which led to the discovery of this bug. Cheers, Moritz Moritz Lenz Design & Architecture (CDA) noris network Thomas-Mann-Straße 16-20 90471 Nürnberg Deutschland Tel +49 911 9352 1517 Fax +49 911 9352 100 moritz.lenz@noris.de https://www.noris.de - Mehr Leistung als Standard Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689        
Download smime.p7s
application/x-pkcs7-signature 6.2k

Message body not shown because it is not plain text.

Subject: Not just in substitution
Download (untitled) / with headers
text/plain 189b
Oh, I forgot to add: it's not specific to S/// or any kind of substitution; the same problem is in normal regex matches; the substitution is just there to illustrate the point a bit better.
Subject: Tests added.
Download (untitled) / with headers
text/plain 107b
Tests added to S05-metasyntax/lookaround.t in this commit: https://github.com/perl6/roast/commit/1089a7f9b7
Subject: [REGEX] Some Zero-Width assertion appear to not work in <after>
Download (untitled) / with headers
text/plain 965b
IRC: https://irclog.perlgeek.de/perl6/2017-09-01#i_15101726 If `^` or `«` is used in `<after>` the match fails: 15:13 ab6tract m: say "What::Root::Thing" ~~ /<?after ^ "What::Root::"> .*/; say "What::Root::Thing" ~~ /<?after "What::Root::"> .*/ 15:13 camelia rakudo-moar 909688: OUTPUT: «Nil??Thing??» 15:23 m: say ".zXXXYzYYY" ~~ /<?after « z> .../ 15:23 camelia rakudo-moar 909688: OUTPUT: «Nil?» Even though, `<|w>` and `<!|w>` in `<after>` as well as `$` in `<before>` do work: 15:23 m: say ".zXXXYzYYY" ~~ /<?after <|w> z> .../ 15:23 camelia rakudo-moar 909688: OUTPUT: «?XXX??» 15:23 Zoffix m: say ".zXXXYzYYY" ~~ /<?after <!|w> z> .../ 15:23 camelia rakudo-moar 909688: OUTPUT: «?YYY??» 15:17 m: say "XXXzYYYz" ~~ /... <before z> / 15:17 camelia rakudo-moar 909688: OUTPUT: «?XXX?? before => ???» 15:17 Zoffix m: say "XXXzYYYz" ~~ /... <before z$> / 15:17 camelia rakudo-moar 909688: OUTPUT: «?YYY?? before => ???»


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org