Function winnow::bytes::streaming::tag_no_case
source · pub fn tag_no_case<T, I, Error: ParseError<I>>(
tag: T
) -> impl Fn(I) -> IResult<I, <I as Stream>::Slice, Error>where
I: Stream + Compare<T>,
T: SliceLen + Clone,👎Deprecated since 0.1.0: Replaced with <code>winnow::bytes::tag_no_case</code> with input wrapped in <code>winnow::Partial</code>
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.
Example
use winnow::bytes::streaming::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(ErrMode::Backtrack(Error::new("Something", ErrorKind::Tag))));
assert_eq!(parser(""), Err(ErrMode::Incomplete(Needed::new(5))));WARNING: Deprecated, replaced with winnow::bytes::tag_no_case with input wrapped in winnow::Partial