Is there a parser like plus() that has an upper boundary, to model expressions like Item <- [a-zA-Z0-9]{1,5}
?
Similarly for something like Item <- [a-zA-Z0-9]{3,5}
?
Is there a parser like plus() that has an upper boundary, to model expressions like Item <- [a-zA-Z0-9]{1,5}
?
Similarly for something like Item <- [a-zA-Z0-9]{3,5}
?
Yes, the repeat
operator does that:
Parser item = word().repeat(1, 5);
Check the JavaDoc for additional information.