Raku Cases › Regexes & grammars

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 probes2026-11-28 · 04a1722e · #286
  1. 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 probes2026-11-28 · 04a1722e
  1. 2

    Regex source is checked the same wherever it is written: a /…/ literal, rx, m, s///, a token, rule or regex, a group, a lookaround.

    Also held by regex-source-unquoted-symbol.

6e-gatingRaku++ passesRakudo cannot run it2026-08-19 · 387d2c88
  1. 23

    From 6.e a failed Grammar.parse returns a Failure carrying X::Syntax::Confused; before 6.e it returns Nil.

    grammar G { token TOP { \d+ } }; G.parse("abc").^name is Failure under 6.e and Nil under 6.d

  2. 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 passes2026-10-02 · 99f09017 · #108
  1. 1

    Every way of naming a subrule capture (<a=inner>, $<lo>=<inner>, <a=b=inner>) runs the subrule's action once and files one Match, with its .made, under each name.

  2. 2

    <a=b=inner> calls the rule inner and names its capture both a and b.

allomorph-str-methodsRaku++ passesRakudo passes2026-10-29 · 62a3d9a5 · #212
  1. 2

    Cool.match is self.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 passes2026-11-08 · 853b606b
  1. 1

    An anonymous rule or token interpolated with <$r> or a bare $r in 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 passes2026-11-08 · c2ec4411
  1. 1

    An anonymous rule { … } kept in a variable or passed to a routine matches with sigspace, and a token { … } with ratchet.

    my $r = rule { a b }; 'a b' ~~ $r matches and 'ab' does not

anton-batch-round2Raku++ passesRakudo passes2026-08-28 · 2421c094
  1. 4

    A grammar composing two sibling roles has both roles' rules, and the rules of a composed role's own sub-role too.

  2. 5

    .parse(…, args => (…)) binds the start rule's parameters with the given values.

    Gated.parse('b', args => (True,)) matches and args => (False,) does not

  3. 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 passes2026-09-16 · b22d82fc
  1. 2

    A Match answers .flat, being Positional over its captures.

More from this test: Lists & laziness (1).

audited-language-gaps-1Raku++ passesRakudo passes2026-10-04 · 76f5426d
  1. 4

    A character-class assertion may combine several + terms separated by spaces, as in <+digit +[!]>.

  2. 5

    Under :i a 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 passes2026-10-04 · 39c1aeb6
  1. 5

    A CRLF grapheme can begin a <-[\r]> match.

  2. 8

    Match.hash and %($/) are Maps, and Match.Hash is 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 passes2026-07-23 · 820a2168
  1. 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 passes2026-07-23 · 9baeff7c
  1. 2

    Inside a regex, a < ... > word list may hold quote-like and punctuation characters such as ', #, $ and | as literal alternatives. inferred

  2. 3

    The m match 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 passes2026-09-29 · 78d68426
  1. 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 passes2026-07-31 · 011f7267
  1. 1

    A bracket after an explicit before/after keyword 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 passes2026-11-13 · a2fcf5bb · rakudo#4752
  1. 1

    A bounded quantifier ** min..max repeats 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 four same captures

More from this test: divergences (1).

builtin-char-class-rulesRaku++ passesRakudo passes2026-08-14 · 364c26b6
  1. 1

    The POSIX-named character classes such as <alpha> are Unicode-aware, not ASCII-only.

    <alpha> matches ö

  2. 2

    <alpha> includes _ and excludes Nl characters such as Ⅰ.

  3. 3

    <punct> is the P general category alone: symbols such as +, $ and | are excluded.

  4. 4

    <graph> is alnum ∪ punct, so symbols are excluded from it.

  5. 5

    <print> matches everything that is not Cc, NBSP and emoji included.

  6. 6

    \w and <alnum> match L ∪ Nd ∪ _, so ² (No) is not a word character.

builtin-class-vs-grammar-tokenRaku++ passesRakudo passes2026-08-08 · 62537183
  1. 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 passes2026-09-19 · 32dd94c5
  1. 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. 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>.list holds the captures of $<f>'s own scope.

    $<f>.list is not empty after matching $<f>=((a)(a))

  3. 3

    $0 used 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. 4

    Capture numbering restarts in every alternative, in nested capture scopes too.

capture-var-reads-scoped-matchRaku++ passesRakudo passes2026-11-12 · 33351b91 · #256
  1. 1

    $0, $1, … are $/[0], $/[1], … of the $/ in scope: a my $/, a bound $/, a $/ parameter, a pointy block's $/ or an action method's $/.

  2. 2

    $0 does not outlive the $/ it came from: it is gone after the block or loop body whose ~~ set it, after $/ = Nil, and after m:g, whose $/ is a List of Matches. inferred

  3. 3

    .grep(/…/) leaves the caller's $/ alone.

char-positions-trans-continueRaku++ passesRakudo passes2026-10-21 · cce315ef
  1. 2

    A bare m:c continues from the character position where $/ ended, also after non-ASCII text.

    $_ = "ééaa"; m/a/; m:c/a/ finds the second a

  2. 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 passes2026-08-20 · f730e79e
  1. 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 passes2026-07-22 · c9beb901
  1. 2

    $<name>, with < glued to the $, is a named-capture lookup on $/, not the anonymous state variable.

  2. 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 passes2026-08-06 · 9c84434c
  1. 3

    Match.caps lists 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 passes2026-07-23 · d7b9d40e
  1. 3

    In <alias=.rule> the dot suppresses only the rule-name capture; the alias still captures.

  2. 4

    A positional capture under a quantifier in a grammar rule is an Array of every occurrence in the action method's $/.

    with (...)+, @$0 lists each occurrence

  3. 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 passes2026-10-10 · 29f5aa55
  1. 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 passes2026-08-25 · 5faed01f · #28
  1. 14

    Positional list captures made in a grammar's entry rule are available on the Match that .parse returns. inferred

  2. 15

    || ends a longest-token declarative prefix.

  3. 16

    $/.values slips a list-valued capture into its individual sub-matches.

    <term>+ contributes each Match, so $/.values».made reaches every one

    Also 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 passes2026-08-05 · 4e2c20cd
  1. 6

    A variable interpolated into the pattern of s/// matches its whitespace literally.

    a variable holding ' ' matches a space, not the empty string

  2. 7

    A kebab-case variable name such as $comment-char interpolates whole in the pattern of s///.

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).

dsl-shared-engine-fixesRaku++ passesRakudo passes2026-10-17 · 1f03ed24
  1. 1

    A grammar that does a role still has Grammar as its parent, so it binds a Grammar :$grammar parameter.

  2. 3

    In a grammar with a method ws, a longest-token | whose branch calls a proto regex still picks a branch by how far it matches, instead of failing both. inferred

ecosweep-900-batchRaku++ passesRakudo passes2026-09-09 · 063a5a1a
  1. 1

    .subst-mutate interpolates $var atoms 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 passes2026-08-25 · 6879a71b
  1. 7

    A lexical my rule resolves as a subrule inside a grammar declared in its scope.

    my rule shared-word { \w+ }; grammar LexSubrule { token TOP { <shared-word>+ % '|' } } parses foo|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 passes2026-08-19 · 573667e2
  1. 1

    A multi-match form such as m:g// that matches nothing returns an empty list, not Nil.

    ("abc" ~~ m:g/z/).elems is 0

end-anchor-in-assertion-and-match-sliceRaku++ passesRakudo passes2026-08-20 · 23829be1
  1. 1

    $ directly before the closing > of a lookahead, as in <?before $>, is the end anchor, not the variable $>.

    <?before <upper> || ')' || '(' || $> matches at the end of the string

  2. 2

    A Match takes a slice of its positional captures.

    ($str ~~ /\((.+)\)(\d+)/)[0,1] reads both captures

exe-lexical-token-callsRaku++ passesRakudo cannot run it2026-10-23 · 8644846a
  1. 1

    A <name> in a pattern given to .comb, .split or .contains calls a lexical my token, my regex or my rule of that name.

    'zz'.split(/<two>/) splits on what the lexical token two matches, not between every character

More from this test: divergences (1).

exe-regex-literal-valuesRaku++ passesRakudo cannot run it2026-10-23 · 74806a6d
  1. 1

    A /…/ or rx/…/ literal where its value is taken (a Pair's key, a ternary's branch, an operand of xx) is the Regex object, not a match against $_.

    (/b/ => 1).key is a Regex, and 'a b c'.trans(/\s/ => '_') replaces the spaces

  2. 2

    m// is always a match against $_, also in a value position.

    my $m = m/c/ stores the match, not the Regex

  3. 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. 4

    A regex literal under ?, !, so, not or on either side of &&/|| is a match against the current $_.

    for <xa yb ab> { say $_ if /a/ && /b/ } prints only ab

exe-value-semanticsRaku++ passesRakudo passes2026-11-11 · 090426b0
  1. 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 passes2026-08-11 · 5622338d
  1. 1

    After a failed match every $N is 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 passes2026-08-29 · e745a338
  1. 1

    Every Match produced by .match(:g), .comb(:match) and the s/// family carries the whole subject string as its .orig, so .prematch and .postmatch are taken from the subject.

  2. 2

    .from and .to of a Match from a :g match count characters of the subject, not bytes, even after non-ASCII text.

goal-operator-and-term-categoryRaku++ passesRakudo passes2026-08-15 · 94ef0788
  1. 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 passes2026-09-21 · 70425d86
  1. 1

    A :my %*FOO declared 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 passes2026-11-13 · 2137a05d · rakudo#2059
  1. 1

    An actions class's FALLBACK is called as FALLBACK($name, $/) for every rule the class has no method for.

  2. 2

    The action method of ws fires 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 } fires method ws; <.q> over token q { 'q' } fires method q

grammar-actions-fire-during-parseRaku++ passesRakudo passes2026-10-30 · 594d4aac
  1. 1

    A grammar's action methods fire during the parse, as each subrule completes, so a code assertion after the call reads its .made and a dynamic variable the action sets affects what the next token matches.

    <tag> <?{ $<tag>.made<type> ne 'var' }> sees the value the tag action made

  2. 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 pass2026-09-29 · 72460522
  1. 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 passes2026-10-11 · c87cceb7 · #150 · #152 · #153
  1. 1

    The arguments of a subrule call arrive as values, not strings.

    <.on(False)> binds the Bool False

    Also held by dsl-shared-engine-fixes.

  2. 2

    G.Grammar::parse(…) runs Grammar's parse, not the parse override G declares.

  3. 3

    G.parse answers an instance of the grammar: its .^name is the grammar's, it smartmatches G, and G's methods are callable on it.

    G.parse(…) ~~ G is True

grammar-param-survives-code-blocksRaku++ passesRakudo passes2026-10-02 · 66a0a2de
  1. 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 passes2026-11-13 · e9aaf6b3 · rakudo#2791
  1. 1

    A grammar's .parse and .subparse take their first positional argument as the target, wherever the named arguments stand.

    Chord.subparse(:rule<bare-key>, 'C#') parses 'C#', not the :rule Pair

  2. 2

    A grammar's .parse and .subparse die when the target is undefined.

grand-review-b-parserRaku++ passesRakudo passes2026-09-06 · fa74f74f
  1. 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 ]

  2. 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 passes2026-09-06 · fa74f74f
  1. 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. 2

    \h, \v and \N are Unicode-aware: \h matches NBSP and U+3000, \v matches U+2028 and NEL, and \N matches neither NEL nor VT.

    "\x[A0]" ~~ /\h/ matches; "\x[85]" ~~ /\N/ does not

  3. 3

    In a regex | binds tighter than ||.

    ("abc" ~~ / a | ab || abc /).Str is ab; ("abc" ~~ / a || ab | abc /).Str is a

  4. 4

    . in a regex matches a newline and takes a CRLF pair as one character.

  5. 5

    ^^ does not match after a final newline, and $$ matches once before a final newline.

    "a\n".match(/^^/, :g).elems is 1; "a\nb".match(/$$/, :g).elems is 2

  6. 6

    The inline regex modifier :r is :ratchet and forbids backtracking into a quantifier.

    "aaab" ~~ /:ratchet a+ ab/ does not match

  7. 8

    A die inside 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 passes2026-07-29 · e955067e
  1. 2

    A Match's .from and .to are character positions, not byte offsets, in a non-ASCII string.

More from this test: Strings & Unicode (1).

grapheme-units-split-rules-sprintfRaku++ passesRakudo passes2026-10-21 · 1918e400
  1. 2

    <space> and <cntrl> in a regex match a CR LF as one whole character, as \s does.

    "a\r\nb" ~~ /a <space> <space> b/ does not match

More from this test: Stringification (1), Strings & Unicode (3).

http-useragent-clusterRaku++ passesRakudo passes2026-08-05 · 271e54e8
  1. 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.

  2. 5

    Grammar action methods fire for completed subrules even when the overall parse fails, and $<child>.made is visible to parent actions.

  3. 6

    A string variable interpolated into a regex matches literally, every ASCII punctuation character included.

    an interpolated $file holding ?r=1&r=2 matches 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 passes2026-08-20 · 0039c700
  1. 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/).elems counts the matches

More from this test: Operators (2).

imported-token-runs-as-a-subruleRaku++ passesRakudo passes2026-09-15 · 43815963
  1. 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 passes2026-07-27 · e143336a
  1. 4

    A routine declared with my regex R {…} is a Regex, not a Sub. 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 passes2026-08-28 · 2421c094
  1. 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.

  2. 15

    A code assertion in a grammar rule sees the rule's positional captures.

    rule only-ba { (\w+) <?{ $0.Str eq 'ba' }> } parses ba and rejects zz

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 passes2026-10-02 · 76f2a994 · #116
  1. 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 passes2026-10-08 · 1c330188 · #138
  1. 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. 2

    In the pattern of s///, a { … } inside a double-quoted atom is interpolated, for {$name} and {NAME} alike. inferred

  3. 3

    A value interpolated into a double-quoted regex atom is matched as literal text: a $, { or @ in it is not read again.

  4. 4

    A regex value reached through <$r> or .subst-mutate looks 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 passes2026-10-09 · 43370447 · #139
  1. 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. 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 passes2026-11-11 · ca60fcc7 · #142
  1. 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 passes2026-10-18 · 166d51b9 · #147 · #180
  1. 1

    A ~~ against a regex that holds a code block (<?{ … }>, { … }), or against an anonymous regex { … } value, sets $/, $0 and $<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 passes2026-09-03 · 2ebb6996 · #64
  1. 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 as self that carries .pos, .target and .orig and answers the grammar's rules as methods.

    [ 'c' || <.panic("expected c")> ] reaches method panic

  2. 2

    When a grammar method is called as a subrule, a returned Match continues the parse at its end, returning self is a zero-width pass, a failed rule call fails the subrule, and a die propagates out of .parse.

issue-98-seqalt-quantified-captureRaku++ passesRakudo passes2026-09-23 · b6b8fe18 · #98
  1. 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 it2026-08-27 · c63eb77a · #37
  1. 8

    A Junction whose eigenstates are interpolating regexes such as rx/ <$_> / matches each one in the scope it closed over.

    any @globs built from rx/ <$_> / 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 passes2026-09-02 · 64311917 · #54
  1. 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. 2

    <alias=rule> used outside a grammar records its match under the alias name.

  3. 3

    Match.Slip is the Match's positional captures, not the Match itself.

More from this test: Lists & laziness (1).

itemization-and-list-foldsRaku++ passesRakudo passes2026-07-26 · 0ccec43d
  1. 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 passes2026-09-20 · eb4b5035
  1. 1

    Smartmatching against a junction of regexes collapses to a Bool and leaves $/ untouched.

    'abc' ~~ all(/(a)/, /(b)/) is True and does not set $/

  2. 2

    A regex handed to .grep or .first as the pattern does not change the caller's $/.

    <ab ac>.grep(/(a)/) leaves a previously set $/ alone

  3. 3

    A junction topic matched against a regex answers a junction of Match objects and does not publish them in $/.

  4. 4

    A block handed to .grep or .map is the caller's own code, and a match made inside it sets $/ and $0 that the block can read.

lookahead-right-word-boundaryRaku++ passesRakudo passes2026-10-02 · 99f09017 · #105
  1. 1

    >> inside a lookahead assertion is the right word boundary, not the end of the assertion.

ltm-declarative-prefixRaku++ passesRakudo passes2026-08-08 · 1e9e964f · #61
  1. 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 ] | abc on "abcd" picks abc

  2. 2

    Ranking the branches of | runs no user code: a losing branch's code block does not fire.

  3. 3

    || is sequential: its later branches are not longest-token candidates.

  4. 4

    On equal declarative prefix length under |, a literal beats a character class.

  5. 5

    A proto regex with plain token t:sym<x> candidates picks the candidate with the longest declarative prefix.

  6. 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. 7

    :m literals take part in longest-token ranking, and a lexical my rule used as a subrule extends the declarative prefix, its sigspace included.

  8. 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. 9

    A composed character class <[...] +rule> counts as a one-character union when branches of | are ranked.

  10. 10

    A branch X* % Y under | 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 passes2026-11-26 · 28fc129a · #286
  1. 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 passes2026-10-14 · 8edfb4c7
  1. 1

    :continue(N) and :pos(N) count characters (graphemes), not bytes or codepoints, on .match and on m:c(N)/…/, so a match never starts before N when non-ASCII text precedes it.

match-continue-ignoremarkRaku++ passesRakudo passes2026-11-11 · dec6d962 · #246
  1. 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 passes2026-11-24 · 6d2ee659
  1. 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. 2

    $m{*} on a Match answers the named captures' values.

  3. 3

    $m{'a';'c'} on a Match answers the capture c inside the capture a.

match-offsets-count-crlf-onceRaku++ passesRakudo passes2026-10-02 · 99f09017 · #102
  1. 1

    A match offset counts "\r\n" as one character, as .chars does.

match-offsets-linearRaku++ passesRakudo passes2026-10-09 · 06296070 · #140
  1. 2

    A Match's .from equals the grapheme count (.chars) of its .prematch, and .to the grapheme count up to the end of the match.

match-which-and-self-in-ruleRaku++ passesRakudo passes2026-10-02 · 99f09017 · #109
  1. 1

    Two Matches of the same text are two objects: distinct .WHICH, two keys of an object hash, two elements of a Set.

  2. 2

    self in a rule's code is the cursor the rule was called with.

math-nintegrate-fixesRaku++ passesRakudo passes2026-09-29 · e7be1d17
  1. 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 passes2026-07-26 · 8782278a
  1. 7

    .subst-mutate substitutes in place in the invocant's variable and returns the Match.

More from this test: Dates & times (1), Hashes & sets (1), Lists & laziness (3), Stringification (1), Strings & Unicode (1).

modinfo-ecosystem-clusterRaku++ passesRakudo passes2026-08-02 · 2d99420e
  1. 13

    make inside a protoregex candidate sets the candidate's own .made, not that of its <sym> sub-match.

    token match:sym<*> { <sym> { make "STAR" } } makes $<match>.made equal STAR

  2. 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

  3. 16

    .split and .comb interpolate 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 passes2026-07-23 · 009d2c9d
  1. 3

    A Regex object in boolean context matches against $_.

More from this test: Lists & laziness (1), Signatures & dispatch (1), Syntax & parsing (1).

module-page-sextetRaku++ passesRakudo passes2026-07-30 · 8de6c3a0
  1. 1

    Under sigspace, a space before a quantifier puts <.ws> inside the repetition, and a % separator gets <.ws> after it and only there.

  2. 2

    Under inline :ignoremark/:m, regex literals compare base codepoints and consume the whole grapheme, for combining marks and precomposed characters alike.

  3. 3

    \cNN is a decimal codepoint escape in a regex — bare, as a character-class member and in a class range.

    <-[\c32..\c126]> excludes printable ASCII

  4. 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.

  5. 6

    A token/rule parameter 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<…>.

  6. 11

    Match.join joins the positional captures, a Match being a Capture.

  7. 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 passes2026-11-13 · 9e693ab0 · rakudo#6810
  1. 1

    A my token or my regex returned 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 passes2026-09-08 · 1497afb9 · #69
  1. 1

    A lexical rule, token or regex matched through its &R Callable 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" ~~ &u matches and "abcd" ~~ &u does not

non-ascii-names-in-regex-and-twigilsRaku++ passesRakudo passes2026-10-23 · 9d48b3b5
  1. 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

  2. 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 pass2026-07-22 · 60a51a27
  1. 1

    In a :P5 regex a trailing & is a literal character, so the pattern compiles without X::Syntax::Regex::NullRegex.

    rx:P5/^[<>]&/ compiles

package-relative-namesRaku++ passesRakudo passes2026-07-23 · 0e4912e1
  1. 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 passes2026-07-26 · 4f4be87d
  1. 4

    Match.target is the same string as .orig.

More from this test: Signatures & dispatch (3).

pdf-family-2026-09Raku++ passesRakudo passes2026-09-14 · a3586267
  1. 15

    \n inside a regex character class is the logical newline.

  2. 16

    A character class that carries a codepoint escape still honours \d, \s, \w and \n in the same class.

    "5" ~~ /<[ \x41 \d ]>/ matches

  3. 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 passes2026-08-27 · 23cd3de6
  1. 1

    When a predicate block returns a Regex, .first, .grep, toggle and 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 passes2026-07-27 · 40bb85d6
  1. 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 passes2026-08-04 · 6598ae5a
  1. 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 passes2026-10-05 · 892e6c61
  1. 10

    <( )> in an interpolated regex marks only the inner match.

  2. 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 passes2026-10-05 · e209ae16
  1. 2

    CR LF is a member of a character class only through \n or a negated class (<[\n]>, <-[\v]>), not <[\v]> or <[\x0A]>, while a standalone \v still matches it.

  2. 10

    token t:sym(EXPR) and method t:sym(EXPR) take an expression as the :sym adverb's value. inferred

  3. 11

    A quantifier in a rule gives text back across the whitespace after it.

  4. 13

    Subscript adverbs work on match variables: $0:exists and $<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 passes2026-10-05 · be813251
  1. 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 passes2026-10-05 · c5326843
  1. 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 passes2026-10-05 · 93d444fb
  1. 6

    @<p>:exists and %<h>:exists drop 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 passes2026-10-05 · e9cf7c7b
  1. 5

    make with no Match in $/ dies X::Make::MatchRequired; with one, the match takes the value.

  2. 6

    A hash as a regex assertion (<$h> holding a hash, <%h>, a hash inside <@a>) is X::Syntax::Reserved.

More from this test: Scoping & phasers (1), Signatures & dispatch (2), Types & coercion (2).

rakuglaze-round-6Raku++ passesRakudo passes2026-10-09 · 8902cac9
  1. 2

    A dynamic variable $*name interpolates 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 passes2026-08-20 · e06e5992
  1. 1

    <~~> recurses into the pattern it is written in, also when that Regex is interpolated into another pattern.

    my $re = rx/ '(' <~~>* ')' /; "(())" ~~ /^$re$/ matches

  2. 3

    @$/ is a Match's positional captures.

    ~« @$/ reads $0 $1 $2 at once

More from this test: Containers & assignment (1).

redispatch-grammar-parse-overrideRaku++ passesRakudo passes2026-07-22 · 60a51a27
  1. 1

    In a grammar that overrides parse or subparse, nextwith redispatches to the built-in method and returns its result, not Nil.

regex-alias-interp-comb-matchRaku++ passesRakudo passes2026-08-23 · 6ba0d376
  1. 1

    <alias=$var> compiles the variable's value as a regex and captures its match under alias.

    /<mymatch=$pattern>/ matches only where $pattern matches

  2. 2

    .comb($rx, :match) returns Match objects, captures included, not strings.

    $data.comb(/<mymatch=$pattern>/,:match)>>.<mymatch> reads each named capture

regex-alt-captures-and-cursorRaku++ passesRakudo does not pass2026-08-30 · 0b42e184
  1. 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. 2

    A code block run in the middle of a match sees a repeated named capture as the list it will be.

  3. 3

    An embedded { … } block in an alternation branch runs exactly once when its branch wins; choosing between branches does not run it.

  4. 4

    Positional capture numbering restarts at $0 in every alternative of | and of ||.

    ('xy' ~~ / (a)(b) | (x)(y) /).list is x, y

  5. 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.elems is 1; ('b' ~~ / [(a)]? (b) /).list.elems is 2

  6. 6

    After a match with fewer captures than the previous one, $0…$N slots the new match does not have are undefined rather than left over from the earlier match.

regex-array-in-code-blocksRaku++ passesRakudo passes2026-09-08 · 70a06a46
  1. 1

    Inside the code regions of a regex ({…}, <?{…}>, <!{…}>, <{…}>, **{…} and :my …;), @array is the real array.

    @arr.elems and @arr[1] inside <?{ … }> see the array's own elements

  2. 2

    A bare @arr in a regex pattern interpolates as a longest-token alternation of its elements.

regex-block-exit-leavesRaku++ passesRakudo passes2026-11-10 · 1fae9cc8
  1. 1

    An exit in 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 passes2026-08-23 · 085cd462
  1. 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. 2

    <?[…]> and <![…]> are zero-width assertions holding a character class, so a [ inside is a member, while in a?[b] the ? is a quantifier and the [ opens a group.

    <?[[]> asserts a literal [

regex-capture-marker-and-mirrored-quotesRaku++ passesRakudo passes2026-08-03 · 34cda960
  1. 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 passes2026-11-13 · d45f616e · rakudo#5799
  1. 1

    \c[NAME] in a regex takes the character name in any letter case, as a string does.

    /o\c[combining ring above]/ matches "o̊"

  2. 2

    In a regex a base character followed by a combining mark written as \c[NAME] is one literal grapheme.

    /.\c[combining ring above]/ does not match "o̊"

regex-class-assertion-needs-its-closeRaku++ passesRakudo passes2026-11-12 · 9c45b83d · #254
  1. 1

    A character class assertion without its closing > is a compile-time error, "couldn't find final '>'", in m//, rx//, m{}, a regex declaration and s///.

    m/<-[W]*/ is refused: "Unable to parse expression in metachar:sym<assert>; couldn't find final '>'" (X::Comp::FailGoal)

  2. 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 passes2026-08-15 · 084959cd
  1. 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 passes2026-08-15 · 718614ae
  1. 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 passes2026-10-08 · ab01484a
  1. 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. 2

    Outside a <…> class, [ after a quantifier opens a group: \w+ [ ']' ] is a quantified \w followed by a group.

regex-closure-and-io-dotRaku++ passesRakudo passes2026-08-05 · f1028af9
  1. 1

    A regex value closes over the scope that built it, so an interpolated variable still resolves after that scope is gone.

  2. 2

    $^name inside 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 passes2026-09-15 · dc7e9acb · #81
  1. 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 passes2026-10-08 · 5ccae330
  1. 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. 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 passes2026-07-27 · 40bb85d6
  1. 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. 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 $¢ is Nil.

  3. 3

    Inside a regex code block, .pos of the cursor is the position the engine has reached.

  4. 4

    A $var inside 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. 5

    Regex code blocks also run when matching with :g or :nth.

regex-corner-quotes-and-block-recursionRaku++ passesRakudo passes2026-11-13 · 1ea5c984 · rakudo#3775
  1. 1

    A 「…」 quote in a regex is a literal, whatever brackets it holds.

    [「{」 <&?BLOCK>? 「}」]? parses

  2. 2

    <&?BLOCK> in a regex calls the regex itself, and the ? of &?BLOCK is no quantifier.

regex-cursor-protocolRaku++ passesRakudo passes2026-09-11 · 6d82fac4
  1. 1

    A Regex value can be invoked on a cursor made with Match.^lookup("!cursor_init")(Match, $haystack, :0c); the result's $!from and $!pos read with nqp::getattr_i give the match (pos -3 for none), and Match.^lookup("CURSOR_MORE") continues after it.

regex-ignorecase-on-interpolated-atomRaku++ passesRakudo passes2026-10-08 · ab01484a
  1. 1

    :i and :m apply to a regex atom whose value is looked up at match time — a variable, $( … ), a { … } in a double-quoted atom — with full case folding.

    token { :i $x } matches ABC for $x = 'abc'; straße matches STRASSE

  2. 2

    A backreference stays exact under :i.

    m:i/(a) $0/ does not match aA

regex-literal-is-a-valueRaku++ passesRakudo passes2026-08-27 · 023300db · #34
  1. 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. 2

    Boolifying a Regex matches it against $_ and sets $/.

    if /b/ and if $rx both match against $_

  3. 3

    A bare regex statement in sink context matches against $_.

  4. 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 passes2026-09-16 · f130fff1
  1. 1

    \S, \D, \W and \N inside a character class are the negated classes, not the literal letters.

    <[\S]> matches any non-space character, not just S

  2. 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 pass2026-08-15 · 2bf077df
  1. 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. 2

    A Regex value interpolated into another regex keeps its own syntax: a spliced :P5 regex is matched as Perl 5, not re-read as Raku.

    a spliced P5 [a-z]+ stays a character class

  3. 3

    A Regex value interpolated into the pattern of s/// is spliced as a regex, not matched as its stringification.

    s/^($token) \: ' '?// matches what $token matches

regex-property-value-aliasesRaku++ passesRakudo does not pass2026-10-17 · 32d904e3
  1. 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

  2. 3

    The bare long general-category names <:Uppercase_Letter>, <:Combining_Mark> and <:Decimal_Number> match only characters of that category. inferred

  3. 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 passes2026-10-09 · b3fa3790
  1. 1

    A named binding $<w>=atom is 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 passes2026-11-10 · 03b3879f
  1. 1

    A ** quantifier count too large for a native integer is refused at compile time.

    /a ** 99999999999999999999/ and /a ** 2..99999999999999999999999/ are refused

  2. 2

    The quantifier **^0 is a compile-time error, an empty range.

regex-quoted-angle-varRaku++ passesRakudo passes2026-10-28 · 6eddeeb5 · #188
  1. 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 passes2026-10-08 · ab01484a · #138
  1. 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 a token/regex body.

    /"{'a"b'}"/ parses as one atom

regex-quoted-escapesRaku++ passesRakudo passes2026-09-16 · 20bfd161
  1. 1

    Inside a quoted span in a regex the control escapes \t, \b, \e, \f, \a and \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, not b

regex-routine-in-a-variableRaku++ passesRakudo passes2026-11-02 · 89d80faa
  1. 1

    A my token, my rule or my regex held in a variable (my $p = &NAME) is a pattern to <$p>, a bare $p and <{ … }> 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 passes2026-10-14 · c2ee3947
  1. 1

    A { inside a character class in rx/…/, m/…/ and rx{…} is a member of the class, not the start of an embedded code block.

    rx/ <[{"]> / ends at its closing /

  2. 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 passes2026-09-16 · 1f4fbe8a
  1. 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 passes2026-07-22 · 60a51a27
  1. 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 passes2026-10-10 · 3fe584d3
  1. 1

    The regex family rx, m, s and tr takes a Unicode bracket for its delimiter.

    rx「\d+」, m⟨x⟩, s「a」 = "b", tr「a」「b」

  2. 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」]> 」 and m{ '}' } end at their last closer

More from this test: Syntax & parsing (1).

regex-unquoted-symbols-refusedRaku++ passesRakudo passes2026-11-14 · d3059bf5 · rakudo#3775 · rakudo#4927
  1. 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 refused

    Also held by regex-metachars, regex-source-unquoted-symbol.

  2. 2

    In a regex = aliases a capture ($<x>=) but is refused after an assertion (<digit>=).

regex-value-naming-itselfRaku++ passesRakudo passes2026-11-12 · 041789fd · rakudo#3775
  1. 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 passes2026-11-08 · c7c4e564
  1. 1

    A $var atom in a regex, token or rule value 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 passes2026-07-31 · 779ead4e · #15
  1. 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. 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. 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 passes2026-11-11 · 15997e10 · #239
  1. 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 passes2026-09-02 · 5cdc21fe
  1. 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>

  2. 3

    A declared my regex R {…} passed as &R works as the pattern of .subst and .split.

  3. 4

    A lexical regex called as <NAME> resolves inside the pattern given to .subst, as it does under ~~.

  4. 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 passes2026-09-28 · bda6f720
  1. 4

    <?[a] - [b]> is a zero-width lookahead of the whole composed character class.

  2. 5

    Longest-token matching counts non-ASCII members of \w and <+alnum> when ranking alternatives.

  3. 6

    A regex code block does not see a $0 left over from an earlier match.

  4. 7

    A ** { … } quantifier with block bounds takes a % separator.

  5. 8

    .match(…, :exhaustive) answers every match, and :nth picks 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 it2026-09-28 · 2cc896bd
  1. 13

    A bare code block in a regex given to .comb runs 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 passes2026-10-27 · 50aebf54
  1. 3

    Inside a named regex's code block &?ROUTINE is the regex.

More from this test: Scoping & phasers (1), Signatures & dispatch (1).

routine-scoped-match-and-when-lastRaku++ passesRakudo passes2026-08-05 · 73e24219
  1. 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 passes2026-10-07 · 4a9c37bd · #147
  1. 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 the my sub is-a declared beside the grammar, also when the grammar is loaded from a module or the token is mixed in with ^mixin

    Also held by dsl-shared-engine-fixes, grammar-issues-147-153.

  2. 2

    The caller's dynamic $* variables are visible to code inside a grammar rule.

rule-separator-sigspaceRaku++ passesRakudo passes2026-09-21 · cb02b1f3 · #94
  1. 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. 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 passes2026-07-25 · 85e74a52
  1. 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 passes2026-10-18 · 39a80444 · #180
  1. 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. 2

    m:x(N)// leaves in $/ the N matches it answers, and none when there are fewer than N.

samecase-ignoremark-graphemesRaku++ passesRakudo passes2026-10-23 · 9d48b3b5
  1. 2

    An :ignoremark literal 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

  2. 3

    :i together with :m compares the simple case folds of the base characters, beyond ASCII too.

    "ÉX" ~~ m:i:m/ ex / matches

  3. 4

    A regex may open with a :my declaration.

    /:my $x = 1; a/ compiles

More from this test: Strings & Unicode (1).

self-in-token-code-blockRaku++ passesRakudo passes2026-11-13 · edc8bf39 · rakudo#3410
  1. 1

    self in the code block of a standalone token (an anonymous token { … } or a my 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. 2

    self.pos in 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 passes2026-07-27 · 40bb85d6
  1. 7

    A list of Matches answers .from and .to with 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 passes2026-08-03 · 27cdc0fd
  1. 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 passes2026-07-26 · 16eefbba
  1. 4

    Inside an array literal a bare /pat/ is the Regex object 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 passes2026-07-26 · 3db5cacf
  1. 1

    .match accepts the occurrence adverbs :continue/:c, :pos/:p, :x(N), :nth(N) and the :1st/:2nd/:3rd/:Nth spellings, with the meaning they have on s///.

  2. 2

    An Array given as the needle of .match is its elements joined by a space.

More from this test: Strings & Unicode (4).

submatch-origRaku++ passesRakudo passes2026-09-23 · c6f99fee · #99
  1. 1

    A submatch's .orig, .target, .prematch and .postmatch are about the whole string being matched, as .from and .to are, 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 passes2026-11-13 · 31206e76 · rakudo#1243
  1. 1

    A grammar's .parse and .subparse start matching at :pos.

    G.subparse("ABCDE", :pos(4)) does not match all five letters

  2. 2

    A failed .subparse answers a failed Match, #<failed match>, not Any.

subrule-action-sees-capture-spanRaku++ passesRakudo passes2026-11-09 · 016f8d57
  1. 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" calls method x once, with 「b」 from 1 to 2

subst-assign-placeholderRaku++ passesRakudo passes2026-07-22 · 60a51a27
  1. 1

    The replacement of the S{...}= substitution form can use a placeholder variable of the enclosing block.

    S{5}=$^a inside a map block substitutes the block's argument

subst-code-interpolation-and-p5Raku++ passesRakudo passes2026-10-04 · fb6b80d4
  1. 1

    <{ $p }> and <?{ $p eq … }> in a regex read $p as code under .subst, .match(:g) and s///, exactly as under ~~.

More from this test: divergences (1).

subst-interpolated-quote-charRaku++ passesRakudo passes2026-11-11 · e5b2b6c8 · #237
  1. 1

    A Str interpolated into an s/// pattern matches literally, as in m// and .subst, also when it holds " or '.

    with $q holding ", s/$q$q/Q/ on a""b does not give Qa""b

subst-replacement-codepoint-escapesRaku++ passesRakudo passes2026-11-11 · 59e9d3aa · #236
  1. 1

    The replacement side of s/// and S/// decodes the escapes \x41, \x[…], \o101, \c65 and \c[NAME].

    s/X/\x41/ on "aXb" gives aAb

  2. 2

    A single-quoted right side of s[…] = '…' is literal and keeps a \x41 as written.

sunk-ternary-regex-matchesRaku++ passesRakudo passes2026-11-08 · 5d7e8be9
  1. 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 passes2026-10-10 · 79f0bc7c
  1. 7

    An undeclared $*name used 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 passes2026-10-30 · 594d4aac
  1. 1

    A subrule call written in a token or rule commits to the callee's first answer, even when the callee is a regex or 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 a regex tag:sym<section> holding (\N*?) to reach the newline

  2. 2

    A regex that calls a regex backtracks into the callee.

top100-chunk-css-2026-09-03Raku++ passesRakudo passes2026-09-03 · bcc2f6b3
  1. 1

    In a character class an escaped punctuation character can be a range endpoint.

    <[ \]..\~ ]> is the range ]..~, so "h" ~~ /^<[ \]..\~ ]>$/ matches

  2. 2

    .parse(:rule<name>) where the entry rule is a proto fires the winning candidate's action method exactly once and does not call an action for the proto.

top100-chunk-d-grammar-made-2026-09-03Raku++ passesRakudo passes2026-09-03 · 3b21cc2c
  1. 1

    A rule reached through a non-capturing <.rule> call still runs its action with its children's .made values available.

    $/<child>.made is set in the action of a rule called as <.rule>

top100-roots-2026-09-02Raku++ passesRakudo does not pass2026-09-02 · 7af75847
  1. 18

    In a regex, a CRLF pair is one grapheme: \n matches it, \s consumes it whole, <[\n]> matches it and <[\r]> does not.

    "\r\n" ~~ /^\s$/ matches

  2. 21

    A # comment inside a <?{ }> code assertion may contain a } without ending the assertion.

  3. 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 passes2026-08-05 · 21d5791b
  1. 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()/ turns content-type into Content-Type

More from this test: Containers & assignment (1).

unicode-num-sigma-fold-collateRaku++ passesRakudo passes2026-07-31 · e85866a4
  1. 3

    m:i uses full case folding, so ß matches ss in 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 passes2026-08-20 · c40e93b5
  1. 2

    m:ov/m:overlap returns all matches like :g, but starts each next search one character past the previous match's start, so matches may overlap.

  2. 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 passes2026-07-23 · 903b4a38
  1. 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 pass2026-09-24 · 2edf4191 · #100
  1. 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..* } in token block(Str $indent, Int $minimum-indent)

  2. 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. 3

    An action fired for a branch that the parse later rejects sees its child matches' .made values, so it does not warn "Use of Nil in string context". inferred

zef-ecosystem-clusterRaku++ passesRakudo passes2026-07-25 · 0cefd08b
  1. 2

    A composed character class of subrules, <-restricted +name-sep>, matches one name-sep or any character not matching restricted.

  2. 3

    The <( and )> capture markers set the match's .from and .to.

  3. 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 passes2026-07-30 · 75f59c3e
  1. 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).