Function combine::parser::regex::captures_many [−][src]
pub fn captures_many<F, G, R, Input>(regex: R) -> CapturesMany<F, G, R, Input> where
F: FromIterator<Input::Range>,
G: FromIterator<F>,
R: Regex<Input::Range>,
Input: RangeStream,
Input::Range: Range,
This is supported on crate feature
regex
only.Expand description
Matches regex
on the input by running captures_iter
on the input.
Returns all captures which is part of the match 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 combine::Parser; use combine::parser::regex::captures_many; fn main() { let mut fields = captures_many(Regex::new("([a-z]+):([0-9]+)").unwrap()); assert_eq!( fields.parse("test:123 field:456 "), Ok((vec![vec!["test:123", "test", "123"], vec!["field:456", "field", "456"]], " " )) ); assert_eq!( fields.parse("test:123 :456 "), Ok((vec![vec!["test:123", "test", "123"]], " :456 " )) ); }