Subrule metacharacters
- Named subrules capture to hash elements of $/
# capture to $/<ident> and $/<expr>
regex assign { <ident> '=' <expr> }
- An alias allows us to capture to a different name
# capture to $/<name> and $/<value>
regex assign { $<name>=<ident> '=' $<value>=<expr> }
# shorter form of above
regex assign { <name=ident> '=' <value=expr> } }
- A leading dot indicates a non-capturing subrule
regex ident { <.alpha> \w* } # <alpha> not captured
- A leading ! is a zero-width negative match
regex { 'abc' <!digit> } # abc not followed by a digit
- A leading ? is a zero-width positive match
regex { <?sigil> <variable> } # parse variable only if sigil found