/// Compares the input with a regular expression and returns the first match.
/// Backported from nom 6.0.0-alpha1. We can't use nom 6.0.0-alpha1 directly,
/// because it had some issues with our use of functions in pattern.rs.
Compares the input with a regular expression and returns the first match.
Compares the input with a regular expression and returns the first match .
fn re_find<'s, E>(re: Regex) -> impl Fn(&'s str) -> IResult<&'s str, &'s str, E>
    where
        E: ParseError<&'s str>,
    {
        move |i| {
            if let Some(m) = re.find(i) {
                Ok((&i[m.end()..], &i[m.start()..m.end()]))
            } else {
                Err(nom::Err::Error(E::from_error_kind(
                    i,
                    ErrorKind::RegexpMatch,
                )))
            }
        }
    }
fn re_find < ' s , E > ( re : Regex ) -> impl Fn ( & ' s str ) -> IResult < & ' s str , & ' s str , E > where E : ParseError < & ' s str > , { move | i | { if let Some ( m ) = re . find ( i ) { Ok ( ( & i [ m . end ( ) .. ] , & i [ m . start ( ) .. m . end ( ) ] ) ) } else { Err ( nom :: Err :: Error ( E :: from_error_kind ( i , ErrorKind :: RegexpMatch , ) ) ) } } }
Compares the input with a regular expression and returns the first match.
Compares the input with a regular expression and returns the first match .
re
Regex