Function count

Source
pub fn count<P>(n: usize, pattern: P) -> Repetition<P>
where P: Pattern,
Expand description

Returns a new pattern that matches exactly n repetitions of pattern.

use bparse::{Pattern, count};

assert_eq!(count(2, "z").eval(b"zzz"), Some(2));
assert_eq!(count(2, "z").eval(b"z"), None);