[−][src]Function combine::parser::regex::find_many
pub fn find_many<F, R, Input>(regex: R) -> FindMany<F, R, Input> where
F: FromIterator<Input::Range>,
R: Regex<Input::Range>,
Input: RangeStream,
Input::Range: Range,
This is supported on crate feature
regex
only.Matches regex
on the input by running find_iter
on the input.
Returns all matches in a F: FromIterator<Input::Range>
.
Consumes all input up until the end of the last match.
extern crate regex; extern crate combine; use regex::Regex; use regex::bytes; use combine::Parser; use combine::parser::regex::find_many; fn main() { let mut digits = find_many(Regex::new("[0-9]+").unwrap()); assert_eq!(digits.parse("123 456 "), Ok((vec!["123", "456"], " "))); assert_eq!(digits.parse("abc 123 456 "), Ok((vec!["123", "456"], " "))); assert_eq!(digits.parse("abc"), Ok((vec![], "abc"))); }