// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)(?<=^\d+\. +).+?(?=\n|$)").unwrap();
let string = "
Open Ended Questions:
1. What makes Vue a popular choice for web development?
2. How does Vue compare to other JavaScript frameworks?
3. What are the advantages of using Vue?
Closed Ended Questions:
1. Does Vue support server-side rendering?
2. Is Vue compatible with TypeScript?
3. Does Vue have a built-in router?";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/