Function any

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

Returns a new pattern that matches as many repetitions as possible of the given pattern, including 0.

use bparse::{Pattern, any};

assert_eq!(any("a").eval(b"aaa"), Some(3));
assert_eq!(any("a").eval(b"aa"), Some(2));
assert_eq!(any("a").eval(b""), Some(0));