[−][src]Function nom::regexp::str::re_matches
pub fn re_matches<'a, E>(
re: Regex
) -> impl Fn(&'a str) -> IResult<&'a str, Vec<&'a str>, E> where
E: ParseError<&'a str>,
Compares the input with a regular expression and returns all matches in a Vec
.
Requires the regexp
feature.
Example
let re = regex::Regex::new(r"a\d").unwrap(); let parser = re_matches::<(&str, ErrorKind)>(re); assert_eq!(parser("a1ba2"), Ok(("", vec!["a1", "a2"]))); assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::RegexpMatches))));