// 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)^(Name=")(Show_Type"|Licensing_Window_End"|Display_As_New")(\s+Value="[A-Za-z0-9-:\s]+")([\/>\s]+)(.*)$"#).unwrap();
let string = "App_Data App=\"MOD\" Name=\"Genre\" Value=\"Series\"/><App_Data App=\"MOD\"
Name=\"Show_Type\" Value=\"Series\"/><App_Data App=\"MOD\" Name=\"Billing_ID\"
Value=\"10092\"/><App_Data App=\"MOD\" Name=\"Licensing_Window_Start\"
Value=\"2019-05-07 00:00:00\"/><App_Data App=\"MOD\"
Name=\"Licensing_Window_End\" Value=\"2019-05-13 23:59:59\"/><App_Data
App=\"MOD\" Name=\"Preview_Period\" Value=\"0\"/><App_Data App=\"MOD\"
Name=\"Display_As_New\" Value=\"4\"/><App_Data App=\"MOD\"
Name=\"Display_As_Last_Chance\" Value=\"7\"/><App_Data App=\"MOD\"
Name=\"Provider_QA_Contact\" Value=\"NBC Universal\"/><App_Data App=\"MOD\"
Name=\"Suggested_Price\" Value=\"0.00\"/><App_Data App=\"MOD\" ";
// 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/