Skip to content

Instantly share code, notes, and snippets.

@qiuhw
Created December 14, 2011 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qiuhw/1475234 to your computer and use it in GitHub Desktop.
Save qiuhw/1475234 to your computer and use it in GitHub Desktop.
Regex bug in Rakudo
The following test file
#===============================================
use Test;
ok 'aa-aa' ~~ / .+ '-' .+/;
ok 'aa-aa' ~~ / .+ '-' (.+)/;
ok 'aa-aa' ~~ / (.+) '-' .+/;
ok 'aa-aa' ~~ / (.+) '-' (.+)/;
ok 'aa-aa' ~~ / .+? '-' .+/;
ok 'aa-aa' ~~ / .+? '-' (.+)/;
ok 'aa-aa' ~~ / (.+?) '-' .+/;
ok 'aa-aa' ~~ / (.+?) '-' (.+)/;
ok '/aa-aa' ~~ / '/' .+? '-' .+/;
ok '/aa-aa' ~~ / '/' .+? '-' (.+)/;
ok '/aa-aa' ~~ / '/' (.+?) '-' .+/;
ok '/aa-aa' ~~ / '/' (.+?) '-' (.+)/;
done;
#=======================================
generates the output as follows:
ok 1 -
ok 2 -
not ok 3 -
not ok 4 -
ok 5 -
ok 6 -
ok 7 -
ok 8 -
ok 9 -
ok 10 -
not ok 11 -
not ok 12 -
1..12
# Looks like you failed 4 tests of 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment