Function tag_no_case

fn tag_no_case<T, I, Error: ParseError<I>>(tag: T) -> impl Fn(I) -> crate::internal::IResult<I, I, Error>
where
    I: Input + Compare<T>,
    T: Input + Clone

Recognizes a case insensitive pattern.

The input data will be compared to the tag combinator's argument and will return the part of the input that matches the argument with no regard to case.

It will return Err(Err::Error((_, ErrorKind::Tag))) if the input doesn't match the pattern.

Example

# use nom::{Err, error::{Error, ErrorKind}, Needed, IResult};
use nom::bytes::complete::tag_no_case;

fn parser(s: &str) -> IResult<&str, &str> {
  tag_no_case("hello")(s)
}

assert_eq!(parser("Hello, World!"), Ok((", World!", "Hello")));
assert_eq!(parser("hello, World!"), Ok((", World!", "hello")));
assert_eq!(parser("HeLlO, World!"), Ok((", World!", "HeLlO")));
assert_eq!(parser("Something"), Err(Err::Error(Error::new("Something", ErrorKind::Tag))));
assert_eq!(parser(""), Err(Err::Error(Error::new("", ErrorKind::Tag))));