Anchor to start with is_match_at #907
-
is_match_at starts matching at a specified offset in the provided string. However it uses the anchors /A to match to the beginning of the string and ^ at the beginning of the a line. How can we anchor is_match_at to the start point? To have the following produce a match, for instance:
Other regex libraries (Python in particular) support this behavior and it is quite useful for parsing large files. |
Beta Was this translation helpful? Give feedback.
Answered by
BurntSushi
Sep 22, 2022
Replies: 1 comment 2 replies
-
Can you say why you need to use use regex::Regex;
fn main() {
let re = Regex::new(r"^\w{5}").unwrap();
let text = " Hello";
println!("Found match? {}", re.is_match(&text[1..]));
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
BurntSushi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you say why you need to use
is_match_at
here? Try this instead: