pub fn tag_no_case<T, Input, Error>(tag: T) -> impl Fn(Input)where
    Error: ParseError<Input>,
    Input: InputTake + InputLength + Compare<T>,
    T: InputLength + Clone,
Available on crate feature mtls only.
Expand description

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.


use nom::bytes::streaming::tag_no_case;

fn parser(s: &str) -> IResult<&str, &str> {

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::Incomplete(Needed::new(5))));