Built-in Rules
A number of named rules are provided by default, including a complete set of POSIX-style classes, and Unicode property classes. The list isn’t fully defined yet, but Table 7-7 shows a few you’re likely to see.
Table 7-7. Built-in rules
Rule |
Meaning |
---|---|
|
Match a Unicode alphabetic character. |
|
Match a Unicode digit. |
|
Match a single-space character (the same as |
|
Match any whitespace (the same as |
|
Match the null string. |
|
Match the same thing as the previous match. |
|
Zero-width lookahead. Assert that you’re before a pattern. |
|
Zero-width lookbehind. Assert that you’re after a pattern. |
|
Match any character with the named property. |
|
Replace everything matched so far in the rule or subrule with the given string (under consideration). |
The
<null>
rule
matches a zero-width string (so it’s always true)
and
<prior>
matches
whatever the most recent successful rule matched. These replace the
two behaviors of the Perl 5 null pattern //
, which
is no longer valid syntax for rules.
Get Perl 6 and Parrot Essentials, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.