Skip to content

Anchor to start with is_match_at #907

Answered by BurntSushi
jdoege asked this question in Q&A
Discussion options

You must be logged in to vote

Can you say why you need to use is_match_at here? Try this instead:

use regex::Regex;

fn main() {
    let re = Regex::new(r"^\w{5}").unwrap();
    let text = " Hello";
    println!("Found match? {}", re.is_match(&text[1..]));
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jdoege
Comment options

@BurntSushi
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants