Regexes & grammars
Matching, captures, longest-token ranking, adverbs, and grammar methods.
313 rules from 171 tests. 157 of those tests are confirmed on both engines: Raku++ and Rakudo 2026.11 both pass, or Raku++ gives Rakudo's answer on every probe of a family. The verdict is the test's, not each rule's. How to read a case.
ltm-nestedRaku++ matches Rakudo on 27 of 31 probes- 2
The declarative prefix of an alternative is used for longest-token ranking however the subrule that supplies it is reached.
regex-metacharsRaku++ matches Rakudo on 6 of 16 probes- 2
Regex source is checked the same wherever it is written: a
/…/literal,rx,m,s///, atoken,ruleorregex, a group, a lookaround.Also held by
regex-source-unquoted-symbol.
6e-gatingRaku++ passesRakudo cannot run it- 23
From 6.e a failed
Grammar.parsereturns a Failure carrying X::Syntax::Confused; before 6.e it returns Nil.grammar G { token TOP { \d+ } }; G.parse("abc").^nameisFailureunder 6.e andNilunder 6.d - 26
From 6.e an unknown regex boundary such as
<|f>is a compile error; before 6.e it is a silent no-op."abc" ~~ /<|f> abc/is True under 6.d and "Unrecognized regex boundary" under 6.e
More from this test: Dates & times (2), Exceptions & control flow (1), Hashes & sets (3), I/O & processes (2), Lists & laziness (8), Numerics (1), Classes, roles & the MOP (2), Operators (1), Everything else (2), Scoping & phasers (2), Signatures & dispatch (1), Strings & Unicode (6), divergences (1).
alias-forms-run-actions-onceRaku++ passesRakudo passesallomorph-str-methodsRaku++ passesRakudo passes- 2
Cool.matchisself.Str.match, and a needle that is no Regex is matched as its Str.<42>.match("4"),42.match("4")and"42".match(4)are「4」
More from this test: Types & coercion (1).
anon-rule-interpolated-keeps-kindRaku++ passesRakudo passes- 1
An anonymous
ruleortokeninterpolated with<$r>or a bare$rin a regex keeps its sigspace or ratchet.my $r = rule { a b }; "x a b" ~~ /<$r>/matches
More from this test: Stringification (1).
anon-rule-value-keeps-sigspaceRaku++ passesRakudo passes- 1
An anonymous
rule { … }kept in a variable or passed to a routine matches with sigspace, and atoken { … }with ratchet.my $r = rule { a b }; 'a b' ~~ $rmatches and 'ab' does not
anton-batch-round2Raku++ passesRakudo passes- 4
A grammar composing two sibling roles has both roles' rules, and the rules of a composed role's own sub-role too.
- 5
.parse(…, args => (…))binds the start rule's parameters with the given values.Gated.parse('b', args => (True,))matches andargs => (False,)does not - 6
<name=[…]>is a named capture of an inline character class.~$m<sign>is-
More from this test: Hashes & sets (3), Native types & NativeCall (1), Classes, roles & the MOP (2), Signatures & dispatch (1).
any-flatmap-and-match-flatRaku++ passesRakudo passes- 2
A Match answers
.flat, being Positional over its captures.
More from this test: Lists & laziness (1).
audited-language-gaps-1Raku++ passesRakudo passes- 4
A character-class assertion may combine several
+terms separated by spaces, as in<+digit +[!]>. - 5
Under
:ia named character class member does not case-fold.
More from this test: Concurrency (1), Containers & assignment (1), Exceptions & control flow (1), Hashes & sets (1), Lists & laziness (2), Operators (1), Signatures & dispatch (3), Syntax & parsing (2).
audited-language-gaps-2Raku++ passesRakudo passes- 5
A CRLF grapheme can begin a
<-[\r]>match. - 8
Match.hashand%($/)are Maps, andMatch.Hashis a Hash.
More from this test: Compile-time errors (2), Containers & assignment (1), Dates & times (1), Lists & laziness (3), Operators (1), Strings & Unicode (2), Types & coercion (1).
base64-sextetRaku++ passesRakudo passes- 8
An array interpolated into a regex,
/@arr/, matches as an alternation of its elements taken literally, longest first, for both~~and.comb.
More from this test: Exceptions & control flow (1), Lists & laziness (1), Scoping & phasers (1), Signatures & dispatch (4).
batch11-parse-clusterRaku++ passesRakudo passes- 2
Inside a regex, a
< ... >word list may hold quote-like and punctuation characters such as',#,$and|as literal alternatives. inferred - 3
The
mmatch operator accepts a comma as its delimiter. inferred"ABC" ~~ m:i,^abc$,matches
More from this test: Operators (1), Signatures & dispatch (1), Syntax & parsing (3).
battery-regressions-v5Raku++ passesRakudo passes- 5
A named subrule inside a quantified capture group is a single Match in each repetition's capture, not a List. inferred
More from this test: Hashes & sets (1), I/O & processes (1), Modules (2), Classes, roles & the MOP (1), Operators (1), Signatures & dispatch (2).
before-assertion-groupRaku++ passesRakudo passes- 1
A bracket after an explicit
before/afterkeyword is a non-capturing group, not a character class; the<?[…]>/<![…]>class shorthand applies only without the keyword.in
<?before [ 'a' ]* 'b'>the brackets group
bounded-quantifier-zero-width-itemRaku++ passesRakudo passes- 1
A bounded quantifier
** min..maxrepeats an item that matches zero width up to the maximum (or, when frugal, to the minimum), recording a capture for each repetition.'00000' ~~ m{^ 0 <same> ** 2..4}matches with foursamecaptures
More from this test: divergences (1).
builtin-char-class-rulesRaku++ passesRakudo passes- 1
The POSIX-named character classes such as
<alpha>are Unicode-aware, not ASCII-only.<alpha>matchesö - 2
<alpha>includes_and excludes Nl characters such asⅠ. - 3
<punct>is the P general category alone: symbols such as+,$and|are excluded. - 4
<graph>is alnum ∪ punct, so symbols are excluded from it. - 5
<print>matches everything that is not Cc, NBSP and emoji included. - 6
\wand<alnum>match L ∪ Nd ∪_, so²(No) is not a word character.
builtin-class-vs-grammar-tokenRaku++ passesRakudo passes- 1
Inside a grammar an undotted built-in character-class name such as
<blank>,<digit>or<alpha>resolves to the grammar's own token of that name when one is defined; the built-in is only a fallback.with
token blank { \h* \n }in the grammar,<blank>calls that token
capture-scopingRaku++ passesRakudo passes- 1
Every capture,
( … )or$<x>=( … ), is a capture scope holding its own positional captures numbered from 0 and the names matched inside it.after
"ab" ~~ /(a(b))/,$0[0]is the inner match and not Nil - 2
The groups inside
$<f>=((a)(a))belong to the capture scopes they are written in, not to the top-level positional list, so$<f>.listholds the captures of$<f>'s own scope.$<f>.listis not empty after matching$<f>=((a)(a)) - 3
$0used as a backreference inside a group refers to the capture numbered 0 in that group's own scope, the one beside it, not to the group itself. - 4
Capture numbering restarts in every alternative, in nested capture scopes too.
capture-var-reads-scoped-matchRaku++ passesRakudo passes- 1
$0,$1, … are$/[0],$/[1], … of the$/in scope: amy $/, a bound$/, a$/parameter, a pointy block's$/or an action method's$/. - 2
$0does not outlive the$/it came from: it is gone after the block or loop body whose~~set it, after$/ = Nil, and afterm:g, whose$/is a List of Matches. inferred - 3
.grep(/…/)leaves the caller's$/alone.
char-positions-trans-continueRaku++ passesRakudo passes- 2
A bare
m:ccontinues from the character position where$/ended, also after non-ASCII text.$_ = "ééaa"; m/a/; m:c/a/finds the seconda - 3
:continue(N)and:pos(N)count characters (graphemes), not bytes.
More from this test: Strings & Unicode (1).
class-range-spaces-set-identity-aliasRaku++ passesRakudo passes- 1
Whitespace inside a character class is insignificant, around the
..of a range too.<[ a .. z ]>is<[a..z]>
More from this test: Containers & assignment (1), Operators (1), Syntax & parsing (1).
corpus-batch-2Raku++ passesRakudo passes- 2
$<name>, with<glued to the$, is a named-capture lookup on$/, not the anonymous state variable. - 4
The replacement part of
s///decodes backslash escapes as a double-quoted string does.s/x/\n/inserts a newline, not the letter n
More from this test: Compile-time errors (1), Scoping & phasers (1).
cro-core-clusterRaku++ passesRakudo passes- 3
Match.capslists positional and named captures, one entry per occurrence, in match order.
More from this test: Concurrency (4), Containers & assignment (1), Classes, roles & the MOP (2), Scoping & phasers (1).
cro-family-clusterRaku++ passesRakudo passes- 3
In
<alias=.rule>the dot suppresses only the rule-name capture; the alias still captures. - 4
A positional capture under a quantifier in a grammar rule is an Array of every occurrence in the action method's
$/.with
(...)+,@$0lists each occurrence - 9
A regex character class accepts a range between hex escapes, as in
<[\x21..\xFF]>.
More from this test: Hashes & sets (1), Lists & laziness (1), Classes, roles & the MOP (2), Syntax & parsing (2).
cro-install-engine-fixesRaku++ passesRakudo passes- 1
A proto-regex alternative that calls a qualified subrule (
<dt=G::rule>) still competes in longest-token matching by its literal prefix.
More from this test: Concurrency (4), I/O & processes (1), Lists & laziness (1), Classes, roles & the MOP (1), Signatures & dispatch (7), Strings & Unicode (1), Syntax & parsing (2).
dbdish-native-and-list-defectsRaku++ passesRakudo passes- 14
Positional list captures made in a grammar's entry rule are available on the Match that
.parsereturns. inferred - 15
||ends a longest-token declarative prefix. - 16
$/.valuesslips a list-valued capture into its individual sub-matches.<term>+contributes each Match, so$/.values».madereaches every oneAlso held by
match-values-slips-captures.
More from this test: Containers & assignment (2), Lists & laziness (1), Native types & NativeCall (5), Classes, roles & the MOP (3), Signatures & dispatch (1), Syntax & parsing (2).
dist-suite-quartetRaku++ passesRakudo passes- 6
A variable interpolated into the pattern of
s///matches its whitespace literally.a variable holding
' 'matches a space, not the empty string - 7
A kebab-case variable name such as
$comment-charinterpolates whole in the pattern ofs///.
More from this test: Dates & times (1), Exceptions & control flow (1), I/O & processes (1), Classes, roles & the MOP (4), Operators (1), Everything else (1), Scoping & phasers (1), Signatures & dispatch (2), Stringification (1), Syntax & parsing (3), Types & coercion (2).
ecosweep-900-batchRaku++ passesRakudo passes- 1
.subst-mutateinterpolates$varatoms in its pattern.
More from this test: Containers & assignment (1), I/O & processes (1), Lists & laziness (4), Numerics (1), Operators (2), Signatures & dispatch (2), Stringification (1), Syntax & parsing (1).
ecosweep-batch-fiveRaku++ passesRakudo passes- 7
A lexical
my ruleresolves as a subrule inside a grammar declared in its scope.my rule shared-word { \w+ }; grammar LexSubrule { token TOP { <shared-word>+ % '|' } }parsesfoo|f|fooo
More from this test: Hashes & sets (1), Native types & NativeCall (2), Classes, roles & the MOP (2), Operators (1), Scoping & phasers (2), Signatures & dispatch (4), Syntax & parsing (1), Types & coercion (2).
empty-global-match-is-a-listRaku++ passesRakudo passes- 1
A multi-match form such as
m:g//that matches nothing returns an empty list, not Nil.("abc" ~~ m:g/z/).elemsis 0
end-anchor-in-assertion-and-match-sliceRaku++ passesRakudo passesexe-lexical-token-callsRaku++ passesRakudo cannot run it- 1
A
<name>in a pattern given to.comb,.splitor.containscalls a lexicalmy token,my regexormy ruleof that name.'zz'.split(/<two>/)splits on what the lexical tokentwomatches, not between every character
More from this test: divergences (1).
exe-regex-literal-valuesRaku++ passesRakudo cannot run it- 1
A
/…/orrx/…/literal where its value is taken (a Pair's key, a ternary's branch, an operand ofxx) is the Regex object, not a match against$_.(/b/ => 1).keyis a Regex, and'a b c'.trans(/\s/ => '_')replaces the spaces - 2
m//is always a match against$_, also in a value position.my $m = m/c/stores the match, not the Regex - 3
A ternary used as a condition or as a statement is taken apart into its branches, so a regex literal in a branch matches the topic there.
if False ?? /q/ !! /c/ { … }matches/c/against$_ - 4
A regex literal under
?,!,so,notor on either side of&&/||is a match against the current$_.for <xa yb ab> { say $_ if /a/ && /b/ }prints onlyab
exe-value-semanticsRaku++ passesRakudo passes- 4
%<x>and@<x>are the capture$<x>in hash and list context: its named and its positional captures.
More from this test: Containers & assignment (1), Hashes & sets (2), Lists & laziness (1), Signatures & dispatch (1), Types & coercion (1).
failed-match-stale-capturesRaku++ passesRakudo passes- 1
After a failed match every
$Nis Nil:$0,$1… always track$/and never keep the captures of an earlier successful match.after an earlier match set
$1,{ "abc" ~~ m/^(nope)/; say ?$1 }says False
global-match-carries-its-subjectRaku++ passesRakudo passesgoal-operator-and-term-categoryRaku++ passesRakudo passes- 1
The regex
~goal operator's body is the single atom after the goal, not the rest of the sequence.'[' ~ ']' <-[\]\n]>+ <.eol>+matches "[core]\n" and rejects "[core\n]"
More from this test: Syntax & parsing (1).
grammar-action-my-dynamicRaku++ passesRakudo passes- 1
A
:my %*FOOdeclared in any grammar rule is visible to the action methods that fire for that rule and the rules it calls, not only when declared in TOP.
grammar-actions-fallback-and-wsRaku++ passesRakudo passes- 1
An actions class's
FALLBACKis called asFALLBACK($name, $/)for every rule the class has no method for. - 2
The action method of
wsfires for an implicit<.ws>in a rule or a written one, and the action method of a one-literal token called as<.q>fires.rule TOP { a b }firesmethod ws;<.q>overtoken q { 'q' }firesmethod q
grammar-actions-fire-during-parseRaku++ passesRakudo passes- 1
A grammar's action methods fire during the parse, as each subrule completes, so a code assertion after the call reads its
.madeand a dynamic variable the action sets affects what the next token matches.<tag> <?{ $<tag>.made<type> ne 'var' }>sees the value thetagaction made - 2
Each grammar node is built and its action fired once: the parent's action, a code block's
$/and the finished tree all get the same Match.
grammar-alias-built-onceRaku++ passesRakudo does not pass- 1
<alias=rule>is one capture that answers to both keys: the rule's action fires once and$<alias> === $<rule>.
grammar-issues-147-153Raku++ passesRakudo passes- 1
The arguments of a subrule call arrive as values, not strings.
<.on(False)>binds the BoolFalseAlso held by
dsl-shared-engine-fixes. - 2
G.Grammar::parse(…)runs Grammar'sparse, not theparseoverride G declares. - 3
G.parseanswers an instance of the grammar: its.^nameis the grammar's, it smartmatchesG, and G's methods are callable on it.G.parse(…) ~~ Gis True
grammar-param-survives-code-blocksRaku++ passesRakudo passes- 1
A token's parameter keeps its value across the token's code blocks and
** { … }bounds, an empty string included.<t('')>reads'', not Nil, in its second code block
grammar-parse-named-before-targetRaku++ passesRakudo passesgrand-review-b-parserRaku++ passesRakudo passes- 5
In a regex a quote character inside a
[ ]group opens a quoted string; only inside a character class is it a literal member.rx/ [ ']' ] /matches a literal] - 6
A
#comment inside a regex runs to the end of its line even when it mentions the regex's delimiter.
More from this test: Compile-time errors (3), Lists & laziness (1), Signatures & dispatch (1), Strings & Unicode (1), Syntax & parsing (5).
grand-review-e-regexRaku++ passesRakudo passes- 1
Backslash escapes inside a character class keep their class meaning:
<[\h]>is horizontal whitespace,<[\v]>vertical whitespace and<[\e]>the ESC character."h" ~~ /<[\h]>/does not match;" " ~~ /<[\h]>/does - 2
\h,\vand\Nare Unicode-aware:\hmatches NBSP and U+3000,\vmatches U+2028 and NEL, and\Nmatches neither NEL nor VT."\x[A0]" ~~ /\h/matches;"\x[85]" ~~ /\N/does not - 3
In a regex
|binds tighter than||.("abc" ~~ / a | ab || abc /).Strisab;("abc" ~~ / a || ab | abc /).Strisa - 4
.in a regex matches a newline and takes a CRLF pair as one character. - 5
^^does not match after a final newline, and$$matches once before a final newline."a\n".match(/^^/, :g).elemsis1;"a\nb".match(/$$/, :g).elemsis2 - 6
The inline regex modifier
:ris:ratchetand forbids backtracking into a quantifier."aaab" ~~ /:ratchet a+ ab/does not match - 8
A
dieinside a regex code block, a code assertion or a grammar token propagates out of the match."ab" ~~ / a { die "inner" } b /dies
More from this test: Compile-time errors (1), divergences (1).
grapheme-indexingRaku++ passesRakudo passes- 2
A Match's
.fromand.toare character positions, not byte offsets, in a non-ASCII string.
More from this test: Strings & Unicode (1).
grapheme-units-split-rules-sprintfRaku++ passesRakudo passes- 2
<space>and<cntrl>in a regex match a CR LF as one whole character, as\sdoes."a\r\nb" ~~ /a <space> <space> b/does not match
More from this test: Stringification (1), Strings & Unicode (3).
http-useragent-clusterRaku++ passesRakudo passes- 4
The escapes
\x41,\x[263a]and\o[17]decode inside a double-quoted span in a regex, while a single-quoted span keeps the backslash. - 5
Grammar action methods fire for completed subrules even when the overall parse fails, and
$<child>.madeis visible to parent actions. - 6
A string variable interpolated into a regex matches literally, every ASCII punctuation character included.
an interpolated
$fileholding?r=1&r=2matches that text and is not a regex conjunction
More from this test: Classes, roles & the MOP (1), Everything else (1), Signatures & dispatch (1), Syntax & parsing (2).
hyper-chains-and-the-m-formRaku++ passesRakudo passes- 3
An explicit
m//always matches against$_and returns the match result, even where a bare/…/would be a Regex object.my $m = m/b/is a Match;(m:g/b/).elemscounts the matches
More from this test: Operators (2).
imported-token-runs-as-a-subruleRaku++ passesRakudo passes- 1
A token imported from a module and used as a subrule
<name>in a regex runs that token, rather than matching the empty string.$line ~~ / ^ 'prefix ' <stamp> … /fails when the imported<stamp>does not match
interp-meta-mixin-block-sig-allomorphRaku++ passesRakudo passes- 4
A routine declared with
my regex R {…}is aRegex, not aSub. inferred
More from this test: Lists & laziness (1), Classes, roles & the MOP (1), Signatures & dispatch (1), Strings & Unicode (1), Types & coercion (1), divergences (1).
is-deeply-strict-and-anton-batchRaku++ passesRakudo passes- 14
On a longest-token tie between proto candidates, the first declared wins within one grammar, and the candidate from the derived role wins across role inheritance.
- 15
A code assertion in a grammar rule sees the rule's positional captures.
rule only-ba { (\w+) <?{ $0.Str eq 'ba' }> }parsesbaand rejectszz
More from this test: Hashes & sets (1), I/O & processes (3), Lists & laziness (1), Classes, roles & the MOP (3), Operators (3), Everything else (1), Signatures & dispatch (1), Syntax & parsing (2).
issue-116-module-type-short-namesRaku++ passesRakudo passes- 3
Ranking a proto regex's candidates by longest token does not run their code, so a
|| <.panic>in a candidate fires only when that candidate is actually tried.
More from this test: Modules (1), Types & coercion (1).
issue-138-qq-block-in-regex-atomRaku++ passesRakudo passes- 1
A
{ … }block inside a double-quoted regex atom is qq interpolation whatever it holds — a constant, a sigilless name, a method call, an expression./"x {NAME} y"/matches with the constant's value in place, as do{~NAME},{NAME.Str},{(NAME)}and{1+2} - 2
In the pattern of
s///, a{ … }inside a double-quoted atom is interpolated, for{$name}and{NAME}alike. inferred - 3
A value interpolated into a double-quoted regex atom is matched as literal text: a
$,{or@in it is not read again. - 4
A regex value reached through
<$r>or.subst-mutatelooks up its variables in the scope the regex was written in, not in the caller's. inferred
issue-139-code-block-sees-nested-captureRaku++ passesRakudo passes- 1
A code block or code assertion in a grammar rule sees a capture's own captures:
$<al><s>, a positional capture's$0<s>, and a quantified(\w)+'s list.<al> <?{ $<al><s>.elems == 3 }>sees the three<s>captures of<al> - 2
$<item><sym>inside a regex's code block is a capture lookup and compiles; it is not a<sym>call outside a proto.
issue-142-assertion-sees-repeated-captureRaku++ passesRakudo passes- 1
A name captured more than once in a regex is a list of matches, and a code assertion
<?{ }>or<!{ }>sees that whole list, as a code block does.in
<n> [ ',' <n> ]*,<!{ $<n>.list.first(...) }>sees every<n>matched so far
issue-180-wired-regex-match-varRaku++ passesRakudo passes- 1
A
~~against a regex that holds a code block (<?{ … }>,{ … }), or against an anonymousregex { … }value, sets$/,$0and$<name>in the scope that did the matching and leaves the$/of the scope the regex was written in alone.
issue-64-grammar-method-subruleRaku++ passesRakudo passes- 1
A subrule call
<.name>or<name>in a grammar invokes an ordinary method of the grammar, a parent or a composed role, with a cursor asselfthat carries.pos,.targetand.origand answers the grammar's rules as methods.[ 'c' || <.panic("expected c")> ]reachesmethod panic - 2
When a grammar method is called as a subrule, a returned Match continues the parse at its end, returning
selfis a zero-width pass, a failed rule call fails the subrule, and adiepropagates out of.parse.
issue-98-seqalt-quantified-captureRaku++ passesRakudo passes- 1
Under
||in a token or rule, captures grabbed by a quantified subrule in a branch that then fails do not leak into the match of the branch that wins.after
[ <n> <m>? '=' ]fails, the winning branch's$<m>holds only its own match
issue37-fez-zef-installRaku++ passesRakudo cannot run it- 8
A Junction whose eigenstates are interpolating regexes such as
rx/ <$_> /matches each one in the scope it closed over.any @globsbuilt fromrx/ <$_> /matches only what a glob matches
More from this test: Containers & assignment (1), Modules (3), Syntax & parsing (2), Types & coercion (1).
issue54-interpolated-assertion-capturesRaku++ passesRakudo passes- 1
An interpolated regex assertion (
<$p>,<alias=$p>,<@a>,<alias=@a>) matches the value as a subrule call in its own capture frame, so its captures nest under the alias and do not become the enclosing regex's$0.with
<mymatch=$pattern>and a pattern holding(\S+), the group is$<mymatch>[0], not the host's$0 - 2
<alias=rule>used outside a grammar records its match under the alias name. - 3
Match.Slipis the Match's positional captures, not the Match itself.
More from this test: Lists & laziness (1).
itemization-and-list-foldsRaku++ passesRakudo passes- 10
A list matcher may be a Junction of Regexes, as in
.grep(none /<[aeiou]>/).
More from this test: Containers & assignment (1), Lists & laziness (3), Numerics (1), Operators (2), Stringification (1).
junction-regex-match-varRaku++ passesRakudo passes- 1
Smartmatching against a junction of regexes collapses to a Bool and leaves
$/untouched.'abc' ~~ all(/(a)/, /(b)/)isTrueand does not set$/ - 2
A regex handed to
.grepor.firstas the pattern does not change the caller's$/.<ab ac>.grep(/(a)/)leaves a previously set$/alone - 3
A junction topic matched against a regex answers a junction of Match objects and does not publish them in
$/. - 4
A block handed to
.grepor.mapis the caller's own code, and a match made inside it sets$/and$0that the block can read.
lookahead-right-word-boundaryRaku++ passesRakudo passes- 1
>>inside a lookahead assertion is the right word boundary, not the end of the assertion.
ltm-declarative-prefixRaku++ passesRakudo passes- 1
|alternation ranks its branches by declarative prefix length, not by how far the whole branch can match; a{}block ends the prefix.[ ab {} cd ] | abcon "abcd" picksabc - 2
Ranking the branches of
|runs no user code: a losing branch's code block does not fire. - 3
||is sequential: its later branches are not longest-token candidates. - 4
On equal declarative prefix length under
|, a literal beats a character class. - 5
A proto regex with plain
token t:sym<x>candidates picks the candidate with the longest declarative prefix. - 6
Code assertions
<?{…}>and<!{…}>are zero-width and transparent to longest-token matching: a passing one does not end the prefix, and a failing one fails its branch, in a plain regex too.a positive
<?{ 0 }>fails the match - 7
:mliterals take part in longest-token ranking, and a lexicalmy ruleused as a subrule extends the declarative prefix, its sigspace included. - 8
A lookaround such as
<?before …>or<!before …>ends the declarative prefix, so a rival branch with a longer prefix wins even when declared later, while a branch led by a lookaround stays a candidate. - 9
A composed character class
<[...] +rule>counts as a one-character union when branches of|are ranked. - 10
A branch
X* % Yunder|whose element is recursive stays a viable candidate, and the empty list still matches.a JSON grammar's
<value>* % ','branch is not pruned
More from this test: divergences (1).
ltm-nested-proto-and-param-rulesRaku++ passesRakudo passes- 1
Longest-token ranking of a proto regex's candidates sees through a call to another proto and through a call to a parameterized rule.
Also held by
ltm-nested.
match-continue-after-non-asciiRaku++ passesRakudo passes- 1
:continue(N)and:pos(N)count characters (graphemes), not bytes or codepoints, on.matchand onm:c(N)/…/, so a match never starts before N when non-ASCII text precedes it.
match-continue-ignoremarkRaku++ passesRakudo passes- 1
Str.match($rx, :c(N))and:p(N)start at position N also when the regex carries:m/:ignoremark.the walk
while $s.match($rx, :$c) { $c = $/.pos }ends
match-multidim-subscriptRaku++ passesRakudo passes- 1
A multidim subscript
{*; 'key'}on a Match walks the named captures and answers one element per capture, Nil where the capture has no such key.so $m{*;'prompt-function-cell-spec'}is True for a Match with named captures - 2
$m{*}on a Match answers the named captures' values. - 3
$m{'a';'c'}on a Match answers the capturecinside the capturea.
match-offsets-count-crlf-onceRaku++ passesRakudo passes- 1
A match offset counts "\r\n" as one character, as
.charsdoes.
match-offsets-linearRaku++ passesRakudo passes- 2
A Match's
.fromequals the grapheme count (.chars) of its.prematch, and.tothe grapheme count up to the end of the match.
match-which-and-self-in-ruleRaku++ passesRakudo passesmath-nintegrate-fixesRaku++ passesRakudo passes- 1
A quote character inside a character class of a regex nested in a regex's code block does not open a string.
<!{ $0.Str ~~ / 'Rule' <["']>? $/ }>parses
More from this test: Signatures & dispatch (3), Syntax & parsing (1), Types & coercion (1).
missing-routines-batchRaku++ passesRakudo passes- 7
.subst-mutatesubstitutes in place in the invocant's variable and returns theMatch.
More from this test: Dates & times (1), Hashes & sets (1), Lists & laziness (3), Stringification (1), Strings & Unicode (1).
modinfo-ecosystem-clusterRaku++ passesRakudo passes- 13
makeinside a protoregex candidate sets the candidate's own.made, not that of its<sym>sub-match.token match:sym<*> { <sym> { make "STAR" } }makes$<match>.madeequalSTAR - 15
A Regex variable interpolated into a regex composes as a sub-pattern, and the composition is fixed when the outer regex is constructed.
my $head = rx/\d+/; "123" ~~ rx/^$head$/matches - 16
.splitand.combinterpolate the variables in their regex argument.with
$d = '/',"a//b/c".split(/$d+/)is("a", "b", "c")
More from this test: Hashes & sets (1), I/O & processes (1), Lists & laziness (1), Operators (1), Scoping & phasers (2), Signatures & dispatch (3), Syntax & parsing (7), Types & coercion (1).
module-fixes-batch-1Raku++ passesRakudo passes- 3
A
Regexobject in boolean context matches against$_.
More from this test: Lists & laziness (1), Signatures & dispatch (1), Syntax & parsing (1).
module-page-sextetRaku++ passesRakudo passes- 1
Under sigspace, a space before a quantifier puts
<.ws>inside the repetition, and a%separator gets<.ws>after it and only there. - 2
Under inline
:ignoremark/:m, regex literals compare base codepoints and consume the whole grapheme, for combining marks and precomposed characters alike. - 3
\cNNis a decimal codepoint escape in a regex — bare, as a character-class member and in a class range.<-[\c32..\c126]>excludes printable ASCII - 5
In
<!["]>and<?["]>the assertion's body is a character class, so a quote member is a literal character, not the start of a string. - 6
A
token/ruleparameter default binds when the rule is called without arguments, including a dynamic-variable parameter ($*STOPPER) that stays visible in the rules it calls, and when entered through:rule<…>. - 11
Match.joinjoins the positional captures, a Match being a Capture. - 12
A named capture under a quantifier is list-valued, also inside a substitution's replacement callback.
More from this test: Numerics (1), Classes, roles & the MOP (3), Stringification (2), Strings & Unicode (1).
my-token-closes-over-its-frameRaku++ passesRakudo passes- 1
A
my tokenormy regexreturned from a sub closes over the call that declared it:<{$re}>and variables inside it read that call's lexicals.
More from this test: divergences (1).
named-regex-callable-flagsRaku++ passesRakudo passes- 1
A lexical
rule,tokenorregexmatched through its&RCallable keeps its declarator's flags, exactly as when called as<R>: a rule is sigspace plus ratchet, a token ratchet, a regex neither.with
my rule u { ab cd },"ab cd" ~~ &umatches and"abcd" ~~ &udoes not
non-ascii-names-in-regex-and-twigilsRaku++ passesRakudo passes- 1
A variable whose name starts with a non-ASCII letter is interpolated by name inside a regex and inside a substitution's replacement.
my $é = rx/a/; say "a" ~~ /$é/matches - 3
In a regex or replacement a capture number does not run into a letter after it (
(a)$0é), and a digit starts no variable name.
More from this test: Syntax & parsing (1).
p5-regex-literal-ampRaku++ passesRakudo does not pass- 1
In a
:P5regex a trailing&is a literal character, so the pattern compiles withoutX::Syntax::Regex::NullRegex.rx:P5/^[<>]&/compiles
package-relative-namesRaku++ passesRakudo passes- 5
A regex character class composes user-defined tokens with enumerated sets, as in
<[..] +tok>and<+tok - [..]>, and the token names may be kebab-case.
More from this test: Modules (2), Classes, roles & the MOP (2), Operators (1).
parameter-introspection-detailsRaku++ passesRakudo passes- 4
Match.targetis the same string as.orig.
More from this test: Signatures & dispatch (3).
pdf-family-2026-09Raku++ passesRakudo passes- 15
\ninside a regex character class is the logical newline. - 16
A character class that carries a codepoint escape still honours
\d,\s,\wand\nin the same class."5" ~~ /<[ \x41 \d ]>/matches - 17
A proto-regex candidate whose body is a single character takes part in longest-token ranking.
More from this test: Containers & assignment (8), Exceptions & control flow (1), I/O & processes (1), Lists & laziness (1), Modules (1), Numerics (1), Classes, roles & the MOP (14), Operators (1), Scoping & phasers (4), Signatures & dispatch (9), Syntax & parsing (11), Types & coercion (3).
pred-answer-regex-and-modifier-tempRaku++ passesRakudo passes- 1
When a predicate block returns a Regex,
.first,.grep,toggleand a sequence endpoint boolify it by matching it against the element, setting the caller's$/..first({ /re/ })returns the matching element and sets$/
More from this test: Scoping & phasers (1).
quantifier-modifiers-and-anon-methodsRaku++ passesRakudo passes- 1
A regex quantifier takes a modifier —
?frugal,!greedy,:ratchet (possessive) — and:?/:!are colon spellings of frugal and greedy, so only a bare:is possessive.a*:?is frugal,a*:!greedy,a*:possessive
More from this test: Hashes & sets (1), Classes, roles & the MOP (1).
quoted-literal-backslashRaku++ passesRakudo passes- 1
A single-quoted literal inside a regex keeps its backslashes as literal characters.
in
<utf16_codepoint>+ % '\u'the separator is the two characters\u
More from this test: Concurrency (1).
rakudo-t-language-gaps-1Raku++ passesRakudo passes- 10
<( )>in an interpolated regex marks only the inner match. - 11
An anonymous
rule {…}keeps its sigspace when matched with~~.
More from this test: Compile-time errors (1), Containers & assignment (1), Lists & laziness (1), Classes, roles & the MOP (2), Operators (1), Everything else (1), Scoping & phasers (2), Signatures & dispatch (1), Stringification (2), Strings & Unicode (1), Syntax & parsing (1).
rakudo-t-language-gaps-2Raku++ passesRakudo passes- 2
CR LF is a member of a character class only through
\nor a negated class (<[\n]>,<-[\v]>), not<[\v]>or<[\x0A]>, while a standalone\vstill matches it. - 10
token t:sym(EXPR)andmethod t:sym(EXPR)take an expression as the:symadverb's value. inferred - 11
A quantifier in a
rulegives text back across the whitespace after it. - 13
Subscript adverbs work on match variables:
$0:existsand$<a>:kv.
More from this test: Compile-time errors (1), Exceptions & control flow (2), Hashes & sets (1), Lists & laziness (2), Operators (2), Scoping & phasers (1), Signatures & dispatch (1), Syntax & parsing (1).
rakudo-t-language-gaps-3Raku++ passesRakudo passes- 8
%_in a grammar rule holds the unclaimed named arguments.
More from this test: Compile-time errors (2), Containers & assignment (1), Lists & laziness (2), Modules (1), Classes, roles & the MOP (1), Operators (2), Scoping & phasers (1), Signatures & dispatch (1), Stringification (1), Syntax & parsing (1).
rakudo-t-language-gaps-4Raku++ passesRakudo passes- 4
$<x>=[<sub>]captures a span of text, and the subrule's captures stay the parent's.
More from this test: Compile-time errors (1), Classes, roles & the MOP (3), Operators (2), Scoping & phasers (1), Stringification (1).
rakudo-t-language-gaps-6Raku++ passesRakudo passes- 6
@<p>:existsand%<h>:existsdrop the adverb and stay the list / hash.
More from this test: Lists & laziness (1), Operators (2), Syntax & parsing (1).
rakudo-t-language-gaps-7Raku++ passesRakudo passes- 5
makewith no Match in$/diesX::Make::MatchRequired; with one, the match takes the value. - 6
A hash as a regex assertion (
<$h>holding a hash,<%h>, a hash inside<@a>) isX::Syntax::Reserved.
More from this test: Scoping & phasers (1), Signatures & dispatch (2), Types & coercion (2).
rakuglaze-round-6Raku++ passesRakudo passes- 2
A dynamic variable
$*nameinterpolates in a regex and in a grammar token.
More from this test: Concurrency (1), Exceptions & control flow (1), Hashes & sets (2), I/O & processes (1), Lists & laziness (2), Classes, roles & the MOP (1), Scoping & phasers (1), Syntax & parsing (2).
recursion-failure-and-match-derefRaku++ passesRakudo passes- 1
<~~>recurses into the pattern it is written in, also when that Regex is interpolated into another pattern.my $re = rx/ '(' <~~>* ')' /; "(())" ~~ /^$re$/matches - 3
@$/is a Match's positional captures.~« @$/reads$0 $1 $2at once
More from this test: Containers & assignment (1).
redispatch-grammar-parse-overrideRaku++ passesRakudo passes- 1
In a grammar that overrides
parseorsubparse,nextwithredispatches to the built-in method and returns its result, notNil.
regex-alias-interp-comb-matchRaku++ passesRakudo passesregex-alt-captures-and-cursorRaku++ passesRakudo does not pass- 1
Whether a named capture such as
$<n>is a list is decided by the regex's declared shape: a quantified or repeated name is Positional even when it matched once, while a name reached once, or once in each alternative, is a single Match.Maybe.parse('1')<n>is Positional with 1 element;Alts.parse('1')<n>is not Positional - 2
A code block run in the middle of a match sees a repeated named capture as the list it will be.
- 3
An embedded
{ … }block in an alternation branch runs exactly once when its branch wins; choosing between branches does not run it. - 4
Positional capture numbering restarts at
$0in every alternative of|and of||.('xy' ~~ / (a)(b) | (x)(y) /).listisx,y - 5
A Match's positional list holds the captures of the branch that matched: a trailing unset capture is not in the list, while an unset capture before a set one keeps its slot.
('a' ~~ / (a) (b)? /).list.elemsis1;('b' ~~ / [(a)]? (b) /).list.elemsis2 - 6
After a match with fewer captures than the previous one,
$0…$Nslots the new match does not have are undefined rather than left over from the earlier match.
regex-array-in-code-blocksRaku++ passesRakudo passesregex-block-exit-leavesRaku++ passesRakudo passes- 1
An
exitin a regex's code block — a{ }block, a<?{ }>assertion, a<{ }>pattern or one inside a grammar rule — ends the program with that status."abc" ~~ / a { exit 3 } b /; say "still running"prints nothing and ends with status 3
regex-body-scan-groups-and-classesRaku++ passesRakudo passes- 1
Inside a regex group a quoted literal quotes as usual, so a quoted
]does not close the group; only inside a character class is a quote character a member.in
[ ']'+ ]the quoted]is a literal bracket - 2
<?[…]>and<![…]>are zero-width assertions holding a character class, so a[inside is a member, while ina?[b]the?is a quantifier and the[opens a group.<?[[]>asserts a literal[
regex-capture-marker-and-mirrored-quotesRaku++ passesRakudo passes- 1
In a regex
)>closes the match-capture marker only when a<(opened it; otherwise it is a closing parenthesis followed by the end of an assertion.in
/^<at(0)>/the)>ends the argument list and the assertion
More from this test: Syntax & parsing (1).
regex-char-names-any-caseRaku++ passesRakudo passesregex-class-assertion-needs-its-closeRaku++ passesRakudo passes- 1
A character class assertion without its closing
>is a compile-time error, "couldn't find final '>'", inm//,rx//,m{}, aregexdeclaration ands///.m/<-[W]*/is refused: "Unable to parse expression in metachar:sym<assert>; couldn't find final '>'" (X::Comp::FailGoal) - 2
Between a character class's
]and the closing>of its assertion only a further+/-member or a comment may come.
regex-class-bracket-memberRaku++ passesRakudo passes- 1
Inside a character class (
<[,<-[,<+[) a[is a literal member; character classes do not nest.token pattern-character { <-[^$\\.*+?()[\]{}|]> }is one class
regex-class-members-and-match-varRaku++ passesRakudo passes- 1
Inside
<[…]>no character opens structure: a lone<,{or quote is a member, and only]ends the class./<[ & < > " ' { ]>/is one character class
More from this test: Strings & Unicode (1).
regex-class-set-expression-bracket-memberRaku++ passesRakudo passes- 1
In a character-class set expression a bracketed member after a named one, as in
<:L + ["]>, is a character class, so a",#or(inside it is a literal member.<:L + ["]>is a class of letters plus the double quote - 2
Outside a
<…>class,[after a quantifier opens a group:\w+ [ ']' ]is a quantified\wfollowed by a group.
regex-closure-and-io-dotRaku++ passesRakudo passes- 1
A regex value closes over the scope that built it, so an interpolated variable still resolves after that scope is gone.
- 2
$^nameinside a regex literal is a placeholder parameter of the enclosing block.
More from this test: I/O & processes (2), Types & coercion (1).
regex-code-block-interpolationRaku++ passesRakudo passes- 1
<{ … }>in a regex runs its block at match time and matches the result as a pattern, agreeing with<$var>./^ 'SPOZ2 ' <{FORMAT-VERSION}> \n/matches only that version
regex-code-block-string-holds-braceRaku++ passesRakudo passes- 1
A
}inside a string, a#comment or a nested regex's character class in a regex's code — a{ }block,<?{ }>,<!{ }>,<{ }>,** { }— does not end the code block./ a { $x = '}' } b /parses and runs its block whole - 2
An apostrophe inside an identifier (
don't) in a regex's code block is part of the name and opens no quote.
regex-code-blocksRaku++ passesRakudo passes- 1
A
{…}code block in a regex runs when the engine reaches it, so a branch later abandoned still ran its block and a retried branch runs it again./a+ {…} b/against 'aaa' runs the block six times and matches nothing - 2
Inside a regex code block
$/and$¢are the match as far as the engine has got, positional and named captures included; outside a regex$¢isNil. - 3
Inside a regex code block,
.posof the cursor is the position the engine has reached. - 4
A
$varinside a regex code block or a<?{…}>assertion is the block's own variable, readable and assignable, not interpolated pattern text.{ $c = 42 }in a regex assigns to$c - 5
Regex code blocks also run when matching with
:gor:nth.
regex-corner-quotes-and-block-recursionRaku++ passesRakudo passesregex-cursor-protocolRaku++ passesRakudo passes- 1
A Regex value can be invoked on a cursor made with
Match.^lookup("!cursor_init")(Match, $haystack, :0c); the result's$!fromand$!posread withnqp::getattr_igive the match (pos -3 for none), andMatch.^lookup("CURSOR_MORE")continues after it.
regex-ignorecase-on-interpolated-atomRaku++ passesRakudo passesregex-literal-is-a-valueRaku++ passesRakudo passes- 1
A regex literal evaluates to a Regex object in every value position: a block's last statement, an explicit
return, a ternary branch, the right side of&&..reduce({ /$^a$^b/ })returns a Regex - 2
Boolifying a Regex matches it against
$_and sets$/.if /b/andif $rxboth match against$_ - 3
A bare regex statement in sink context matches against
$_. - 4
~~with a Regex value as its right operand matches the left side against it.
More from this test: Compile-time errors (1).
regex-negated-class-escapesRaku++ passesRakudo passes- 1
\S,\D,\Wand\Ninside a character class are the negated classes, not the literal letters.<[\S]>matches any non-space character, not justS - 2
A set operator in a character-class assertion may be preceded by a blank and still continues the class.
<+[\S] -[?#]>*is one class; its#does not open a comment
regex-p5-class-and-spliceRaku++ passesRakudo does not pass- 1
In a Perl 5 regex (
rx:P5/…/) a[ … ]is a character class in which no character opens a quote or nested construct, and a]in first position ([]…],[^]…]) is a member.rx:P5/[^][\x00-\x1f\x7f()<>@,;:\\"\/?={} \t]+/parses as one class - 2
A Regex value interpolated into another regex keeps its own syntax: a spliced
:P5regex is matched as Perl 5, not re-read as Raku.a spliced P5
[a-z]+stays a character class - 3
A Regex value interpolated into the pattern of
s///is spliced as a regex, not matched as its stringification.s/^($token) \: ' '?//matches what$tokenmatches
regex-property-value-aliasesRaku++ passesRakudo does not pass- 2
A
<:Prop<Value>>whose value the property does not have matches no character, rather than every character.<:sc<Latn>>,<:gc<Uppercase_Letter>>,<:Block<Arrows>>and<:ccc<230>>do not match every character - 3
The bare long general-category names
<:Uppercase_Letter>,<:Combining_Mark>and<:Decimal_Number>match only characters of that category. inferred - 4
<:Block<…>>matches every code point of the block, unassigned ones included, whether or not the block's name is also a script's.U+0530 matches
<:Block<Armenian>>
More from this test: divergences (1).
regex-quantified-named-bindingRaku++ passesRakudo passes- 1
A named binding
$<w>=atomis itself an atom, so a quantifier after the bound atom's own quantifier repeats the binding, each repetition adding one capture to$<w>.$<w>=.*? +%% [ … ]binds.*?and repeats the binding
regex-quantifier-count-edgesRaku++ passesRakudo passesregex-quoted-angle-varRaku++ passesRakudo passes- 1
Inside a double-quoted atom of a regex the angle brackets around a variable are literal text, not the
<$var>assertion./ "<$k>" /with$k = 'abc'matches the text<abc>
regex-quoted-block-string-holds-quoteRaku++ passesRakudo passes- 1
Inside a double-quoted regex atom a
{ … }is code read through its own strings, so a"in a string inside it does not close the atom, in/…/,m!…!,s/…/…/and atoken/regexbody./"{'a"b'}"/parses as one atom
regex-quoted-escapesRaku++ passesRakudo passes- 1
Inside a quoted span in a regex the control escapes
\t,\b,\e,\f,\aand\c[…]are decoded as in a string, so"\b"is BACKSPACE and not a word boundary or the letter b./ "\b" /matches a backspace character, notb
regex-routine-in-a-variableRaku++ passesRakudo passes- 1
A
my token,my ruleormy regexheld in a variable (my $p = &NAME) is a pattern to<$p>, a bare$pand<{ … }>in a regex, keeping a token's ratchet and a rule's sigspace.my $base = $ascii ?? &baseascii !! &base; … <$base> …matches with the chosen token
regex-scan-class-brace-and-group-quoteRaku++ passesRakudo passes- 1
A
{inside a character class inrx/…/,m/…/andrx{…}is a member of the class, not the start of an embedded code block.rx/ <[{"]> /ends at its closing/ - 2
A quote inside a
[ … ]group inside a regex assertion quotes its content, so a#in it is literal and starts no comment./<!before ['#']>/ends at its closing/
regex-spaced-negated-classRaku++ passesRakudo passes- 1
A blank may follow the sign in a named character-class assertion:
<- print>is<-print>.$str.subst(/<- print>/, …, :g)replaces only unprintable characters
regex-tight-inline-adverbRaku++ passesRakudo passes- 1
An inline regex adverb may be followed by an atom with no space between them, as in
/:s^<alpha>/, and the adverb still applies.
regex-unicode-bracket-delimitersRaku++ passesRakudo passes- 1
The regex family
rx,m,sandtrtakes a Unicode bracket for its delimiter.rx「\d+」,m⟨x⟩,s「a」 = "b",tr「a」「b」 - 2
A bracket regex delimiter, Unicode or ASCII, is quote-aware: a closer inside a quote or a character class does not end the regex.
rx「 a '」' b 」,m「 <[x」]> 」andm{ '}' }end at their last closer
More from this test: Syntax & parsing (1).
regex-unquoted-symbols-refusedRaku++ passesRakudo passes- 1
In regex source a character that is neither a word character, whitespace nor regex syntax must be quoted to match as itself; unquoted it is refused at compile time.
/a,b/,/a=b/and/a-b/are refusedAlso held by
regex-metachars,regex-source-unquoted-symbol. - 2
In a regex
=aliases a capture ($<x>=) but is refused after an assertion (<digit>=).
regex-value-naming-itselfRaku++ passesRakudo passes- 1
A regex value that names itself — through
<$r>,<x=$r>, a bare$r, or two values naming each other — is a recursive pattern, called when the match reaches it.my $r; $r = / a <$r>? /matches "aaa", three calls deep
More from this test: divergences (1).
regex-value-variable-atomRaku++ passesRakudo passes- 1
A
$varatom in aregex,tokenorrulevalue matches the variable's value — a Str as a literal, a Regex as a subpattern — reading the variable the closure closed over.my $w = "b"; "ab" ~~ regex { a $w }matches
regex-var-interpolationRaku++ passesRakudo passes- 1
A scalar interpolated into a regex inside angle brackets,
/<$p>/, is compiled as a regex, while a bare/$p/matches the string's text literally.with
$p = "^bar.?",/<$p>/uses the string as a pattern and/$p/matches it as literal text - 2
An array in angle brackets,
/<@arr>/, treats each element as a regex pattern, while a bare/@arr/is an alternation of the elements' literal text./<@arr>/matches "barc" rather than a single "b" - 3
Captures inside a pattern interpolated with the assertion form
<$p>belong to the sub-match and never become the host match's$0.
regex-word-boundary-in-groupRaku++ passesRakudo passes- 1
A
<<word boundary followed by a space in a regex is a word boundary and does not open a< … >word list./ (<< [unit\s+]? [class|role] \s+) (Test) >> /compiles
repl-sandbox-and-capture-scopingRaku++ passesRakudo passes- 2
In a regex,
$<a>=( … )is a capture scope whose inner named captures nest under$<a>, while$<a>=[ … ]only groups and leaves its inner captures at the top level.with
$<a>=( … <b> … )there is$<a><b>and no top-level$<b> - 3
A declared
my regex R {…}passed as&Rworks as the pattern of.substand.split. - 4
A lexical regex called as
<NAME>resolves inside the pattern given to.subst, as it does under~~. - 5
A capture's own sub-captures are available inside the replacement block of
.subst.
More from this test: Compile-time errors (1), Hashes & sets (1).
roast-3log-batch2Raku++ passesRakudo passes- 4
<?[a] - [b]>is a zero-width lookahead of the whole composed character class. - 5
Longest-token matching counts non-ASCII members of
\wand<+alnum>when ranking alternatives. - 6
A regex code block does not see a
$0left over from an earlier match. - 7
A
** { … }quantifier with block bounds takes a%separator. - 8
.match(…, :exhaustive)answers every match, and:nthpicks one of them.
More from this test: Exceptions & control flow (1), Modules (1), Numerics (1), Classes, roles & the MOP (6), Everything else (1), Scoping & phasers (1), Syntax & parsing (1).
roast-sweep-runtimeRaku++ passesRakudo cannot run it- 13
A bare code block in a regex given to
.combruns with$/set to the match in progress. inferred
More from this test: Compile-time errors (4), Concurrency (2), Containers & assignment (2), Exceptions & control flow (2), Hashes & sets (4), I/O & processes (3), Lists & laziness (5), Modules (2), Classes, roles & the MOP (8), Operators (4), Everything else (1), Scoping & phasers (14), Stringification (1), Strings & Unicode (1), Types & coercion (3).
routine-is-lexicalRaku++ passesRakudo passes- 3
Inside a named regex's code block
&?ROUTINEis the regex.
More from this test: Scoping & phasers (1), Signatures & dispatch (1).
routine-scoped-match-and-when-lastRaku++ passesRakudo passes- 1
$/is scoped to each routine activation, methods included, so a match inside a called method does not change the caller's$/.
More from this test: Exceptions & control flow (1), I/O & processes (1), Classes, roles & the MOP (1).
rule-code-sees-its-moduleRaku++ passesRakudo passes- 1
A regex's code blocks run in the lexical scope the regex was written in, not the scope that matches it, so they see the lexical subs and variables declared beside it.
<?{ is-a($0) }>calls themy sub is-adeclared beside the grammar, also when the grammar is loaded from a module or the token is mixed in with^mixinAlso held by
dsl-shared-engine-fixes,grammar-issues-147-153. - 2
The caller's dynamic
$*variables are visible to code inside a grammar rule.
rule-separator-sigspaceRaku++ passesRakudo passes- 1
In a
rule, whitespace is matched around a%separator only where the source has whitespace there, exactly as between two plain atoms.rule { <n>+ % ','}does not match "1, 2";/:s^<alpha>+%\,$/does not match "a, b, c" - 2
In a
rule, a separated quantifier is always followed by a<.ws>call after the whole repetition, even when the source has no space there.rule { <n>+ % ','<[y]>}matches "1,2 y" and not "1,2y"
run-adverbs-keep-undo-rule-captureRaku++ passesRakudo passes- 3
<( … )>inside a grammar rule body trims what the rule's capture reports, while the parse continues from the real end of the match.
More from this test: I/O & processes (1), Modules (1), Scoping & phasers (1).
rx-block-cursor-under-grepRaku++ passesRakudo passes- 1
A code block or code assertion in a regex sees the match so far as
$/(and$<d>,$0) even when the match publishes nothing to the caller, as under.grep(Regex)or a junction's eigenstates; the caller's$/is untouched afterwards.<?{ $/.chars > 1 }>filters under.grep - 2
m:x(N)//leaves in$/the N matches it answers, and none when there are fewer than N.
samecase-ignoremark-graphemesRaku++ passesRakudo passes- 2
An
:ignoremarkliteral steps a grapheme of its own text as it steps one of the input, so marks in the pattern are ignored too."w̲x" ~~ m:m/ w̲x /matches - 3
:itogether with:mcompares the simple case folds of the base characters, beyond ASCII too."ÉX" ~~ m:i:m/ ex /matches - 4
A regex may open with a
:mydeclaration./:my $x = 1; a/compiles
More from this test: Strings & Unicode (1).
self-in-token-code-blockRaku++ passesRakudo passes- 1
selfin the code block of a standalone token (an anonymoustoken { … }or amy token) is the cursor the token was entered with.token { 'a' <?{ say self.pos }> 'a' }runs without "'self' used where no object is available" - 2
self.posin a standalone token's code block is where the token began, or, for a token matched directly with~~, where the scan began.
slices-trans-and-exact-sequencesRaku++ passesRakudo passes- 7
A list of Matches answers
.fromand.towith the span it covers.
More from this test: Hashes & sets (3), Lists & laziness (1), Strings & Unicode (2), Syntax & parsing (1).
socket-type-and-regex-expr-interpolationRaku++ passesRakudo passes- 2
$( … )in a regex interpolates the value of the enclosed expression./ $($buf.bytes) /matches the number of bytes
More from this test: Types & coercion (1).
split-adverbs-and-regex-valuesRaku++ passesRakudo passes- 4
Inside an array literal a bare
/pat/is theRegexobject itself, not a match against$_.split(["a", /b+/, 4], …)keeps the regex delimiter
More from this test: Stringification (1), Strings & Unicode (3).
str-match-adverbs-and-substrRaku++ passesRakudo passes- 1
.matchaccepts the occurrence adverbs:continue/:c,:pos/:p,:x(N),:nth(N)and the:1st/:2nd/:3rd/:Nthspellings, with the meaning they have ons///. - 2
An Array given as the needle of
.matchis its elements joined by a space.
More from this test: Strings & Unicode (4).
submatch-origRaku++ passesRakudo passes- 1
A submatch's
.orig,.target,.prematchand.postmatchare about the whole string being matched, as.fromand.toare, at any depth and inside actions and code blocks.$/.orig.substr(0, $/.from)in an action is the text before the submatch in the whole input
subparse-pos-and-failed-matchRaku++ passesRakudo passessubrule-action-sees-capture-spanRaku++ passesRakudo passes- 1
A subrule's action method is called once, with the match trimmed to the span its
<(or)>marks.token x { a <( b }over "abc" callsmethod xonce, with 「b」 from 1 to 2
subst-assign-placeholderRaku++ passesRakudo passes- 1
The replacement of the
S{...}=substitution form can use a placeholder variable of the enclosing block.S{5}=$^ainside amapblock substitutes the block's argument
subst-code-interpolation-and-p5Raku++ passesRakudo passes- 1
<{ $p }>and<?{ $p eq … }>in a regex read$pas code under.subst,.match(:g)ands///, exactly as under~~.
More from this test: divergences (1).
subst-interpolated-quote-charRaku++ passesRakudo passes- 1
A Str interpolated into an
s///pattern matches literally, as inm//and.subst, also when it holds"or'.with
$qholding",s/$q$q/Q/ona""bdoes not giveQa""b
subst-replacement-codepoint-escapesRaku++ passesRakudo passessunk-ternary-regex-matchesRaku++ passesRakudo passes- 1
A ternary statement sinks the branch it takes, so a regex literal there matches
$_and sets$/; a parenthesized inner ternary is a value and is not sunk.$_ = 'abc'; False ?? /q/ !! /c/;matches /c/ and sets$/
todo-small-divergencesRaku++ passesRakudo passes- 7
An undeclared
$*nameused in a regex throws X::Dynamic::NotFound.
More from this test: Concurrency (1), Containers & assignment (2), Lists & laziness (3), Classes, roles & the MOP (2), Operators (1), Scoping & phasers (2), Stringification (3), Types & coercion (3).
token-commits-to-regex-subruleRaku++ passesRakudo passes- 1
A subrule call written in a
tokenorrulecommits to the callee's first answer, even when the callee is aregexor a proto of them: if what follows fails, the token fails rather than backtracking into the callee.token linetag { ^^ (\h*) <tag> \h* [\n|$] }does not stretch aregex tag:sym<section>holding(\N*?)to reach the newline - 2
A
regexthat calls aregexbacktracks into the callee.
top100-chunk-css-2026-09-03Raku++ passesRakudo passestop100-chunk-d-grammar-made-2026-09-03Raku++ passesRakudo passes- 1
A rule reached through a non-capturing
<.rule>call still runs its action with its children's.madevalues available.$/<child>.madeis set in the action of a rule called as<.rule>
top100-roots-2026-09-02Raku++ passesRakudo does not pass- 18
In a regex, a CRLF pair is one grapheme:
\nmatches it,\sconsumes it whole,<[\n]>matches it and<[\r]>does not."\r\n" ~~ /^\s$/matches - 21
A
#comment inside a<?{ }>code assertion may contain a}without ending the assertion. - 22
In a regex, an escaped
\<inside a< … >word list is a literal member of the list.
More from this test: Containers & assignment (1), Exceptions & control flow (2), Lists & laziness (1), Modules (1), Native types & NativeCall (3), Numerics (1), Classes, roles & the MOP (4), Scoping & phasers (1), Stringification (1), Strings & Unicode (2), Syntax & parsing (3), Types & coercion (6).
topic-alias-and-repl-methodsRaku++ passesRakudo passes- 2
In a substitution replacement a method call on a capture with parentheses,
$0.uc(), is called, as in any interpolating string.$a ~~ s:g/ <|w> (\w) /$0.uc()/turnscontent-typeintoContent-Type
More from this test: Containers & assignment (1).
unicode-num-sigma-fold-collateRaku++ passesRakudo passes- 3
m:iuses full case folding, soßmatchesssin either direction, but a match may not end in the middle of a fold expansion."Weiß" ~~ m:i/WEISS/matches;m:i/WEIS/fails against "Weiß"
More from this test: Numerics (1), Strings & Unicode (2).
where-sees-earlier-params-ov-and-cursorRaku++ passesRakudo passes- 2
m:ov/m:overlapreturns all matches like:g, but starts each next search one character past the previous match's start, so matches may overlap. - 3
Inside a code assertion
$/is the match so far.<?{ $/.chars == 2 }>and<?{ $0 eq $2 }>ask about the current match
More from this test: Numerics (1), Signatures & dispatch (1).
xml-triad-backref-indirect-coerceRaku++ passesRakudo passes- 1
Inside a regex, a bare
$<name>is a backreference: it matches the text captured under that name and makes no new capture.token element { '<' <name> … '</' $<name> '>' }requires the same tag name to close
More from this test: Classes, roles & the MOP (1), Signatures & dispatch (1).
yamlish-issue-100Raku++ passesRakudo does not pass- 1
A regex quantifier
** { $min..* }works when the block's range has a Str endpoint, as when the bound comes from a grammar parameter bound as a Str.' ' ** { $minimum-indent..* }intoken block(Str $indent, Int $minimum-indent) - 2
An aliased subrule
<tags=tag-directive>under a quantified group records a list under both names, so@<tag-directive>is the list of matches. - 3
An action fired for a branch that the parse later rejects sees its child matches'
.madevalues, so it does not warn "Use of Nil in string context". inferred
zef-ecosystem-clusterRaku++ passesRakudo passes- 2
A composed character class of subrules,
<-restricted +name-sep>, matches onename-sepor any character not matchingrestricted. - 3
The
<(and)>capture markers set the match's.fromand.to. - 4
The separator of a quantifier may itself be a quantified group, as in
X* %% [SEP]+.
More from this test: I/O & processes (2), Scoping & phasers (1), Types & coercion (1).
zero-dep-module-sweepRaku++ passesRakudo passes- 5
The adverb part of a regex routine's name may contain a hyphen, as in
token match:character-class.
More from this test: Native types & NativeCall (1), Syntax & parsing (3).