How do I write a rule for
at least N chars - regex [a-z](2,}
at most N chars - regex [a-z](,5}
from N to M chars - regex [a-z]{3,10}
in Parboiled?
How do I write a rule for
at least N chars - regex [a-z](2,}
at most N chars - regex [a-z](,5}
from N to M chars - regex [a-z]{3,10}
in Parboiled?
Copyright © 2021 Jogjafile Inc.
You might be looking for the
times
combinator. You can either usetimes
with a singleInt
(meaning repeat the rule exactlyn
times) or with an(Int, Int)
(meaning repeat the rule betweenn
andm
times). You can usetimes
together withoneOrMore
,zeroOrMore
,~
, and!
for the desired effects: