The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Check If A Text Pattern Matches With Rust's nom Crate

TODO: Pull subtitle into page object
Code
use nom::bytes::complete::tag_no_case;

fn main() {
    assert_eq!(false, matches("brown dog"));
    assert_eq!(true, matches("red fox"));
}

fn matches(source: &str) -> bool {
    let check = tag_no_case::<&str, &str, ()>("red")(source).ok();
    match check {
        None => false,
        Some(_) => true,
    }
}

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Check If A Text Pattern Matches With Rust's nom Crate

-- code

use nom::bytes::complete::tag_no_case;

fn main() {
    assert_eq!(false, matches("brown dog"));
    assert_eq!(true, matches("red fox"));
}

fn matches(source: &str) -> bool {
    let check = tag_no_case::<&str, &str, ()>("red")(source).ok();
    match check {
        None => false,
        Some(_) => true,
    }
}


-- blurb

-- categories
-- Rust
-- nom

-- metadata
-- date: 2023-03-25 15:51:02
-- id: 2nwjnekq
-- site: aws
-- type: post
-- status: draft