Function combine::parser::regex::captures_many
[−]
[src]
pub fn captures_many<F, G, R, I>(regex: R) -> CapturesMany<F, G, R, I> where
F: FromIterator<I::Range>,
G: FromIterator<F>,
R: Regex<I::Range>,
I: FullRangeStream,
I::Range: Range,
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<I::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 " )) ); }