// 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)(\w+)\((?:[^()]+|(?R))*+\)").unwrap();
let string = "Attribute VB_Name = \"mdl_WbkInits\"
Option Compare Database
Function InitWbk_004(byRef wbkRef x ())
Dim wbk As wbk_004_InstoreBrief
Set wbk = New wbk_004_InstoreBrief
Call wbk.wbk_Init(wbkRef)
Set InitWbk_004 = wbk
End Function
Public Function InitWbk_003(ByRef wbkRef As Object) As Object
Dim wbk As wbk_003_3DCalculation
Set wbk = New wbk_003_3DCalculation
Call wbk.wbk_Init(wbkRef)
Set InitWbk_003 = wbk
End Function
";
// 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/