Matching positions

Parse pattern matches (or, in general, evaluates the rules) from left to right. You can visualize this with a position arrow, which points before the input at the start of the rules block:

When rules are matched, the parse position is moved. After the first pattern we get:

Then the some digit pattern processes the rest of the input, the parse position is at the end of the input, and true is returned:

If the input contains ...

Get Learn Red - Fundamentals of Red 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.