We could skip a bunch of backtracking if we figure out how to gather prefixes for patterns and have the prefix choose what path to take.
Example: find all letter or digit will always try matching a letter first then when it fails it will backtrack. However, if instead of even checkpointing for it to ultimately fail we can check if we have a digit or a letter and just confidently go down one path or the other.
We could skip a bunch of backtracking if we figure out how to gather prefixes for patterns and have the prefix choose what path to take.
Example:
find all letter or digit
will always try matching a letter first then when it fails it will backtrack. However, if instead of even checkpointing for it to ultimately fail we can check if we have a digit or a letter and just confidently go down one path or the other.