pub fn at_most<T, P>(n: usize, pattern: P) -> Repetition<P>where
P: Pattern<T>,Expand description
Returns a new pattern that matches at most n repetitions of pattern.
use bparse::{Pattern, at_most};
assert_eq!(at_most(2, "b").eval(b"b"), Some(1));
assert_eq!(at_most(2, "b").eval(b"bbbb"), Some(2));
assert_eq!(at_most(2, "b").eval(b"aa"), Some(0));