Skip to content

Rule with optional suffix, suffix must end in a specific character #742

Discussion options

You must be logged in to vote

I think the problem here is that matching is greedy and does not backtrack. I.e. all the est are consumed in the (ASCII_ALPHANUMERIC|".")* part and there is nothing left for the final ASCII_ALPHANUMERIC. Therefore, the whole (...)? part fails.

I think this rule should work instead:

test_rule = @{ASCII_ALPHA ~ ("."* ~ ASCII_ALPHANUMERIC)* }

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@filippodebortoli
Comment options

@birkenfeld
Comment options

Answer selected by filippodebortoli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants