// 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)(\[.*\]\(audio-1 .*\))|(\[.*\]\(img-1 .*\))|(\[\]\(video-1 .*\))").unwrap();
let string = "[null,null,null](img-1 'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Picture/1/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4yKPRtVfR.png')
[null,null,null](img-1 'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Picture/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4yLavx4gv.png')
[null,null,null](img-1 'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Picture/0/3761f21b-3016-dadd-6198-3a0569770f55/jsjuHxukkZDtF879nQB.jpg')
[](audio-1 'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Audio/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4zfnkYB6m.ogg')
[](audio-1 'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Audio/0/44b29ef1-e567-e1a4-49c6-3a0545afd2f4/jsjuHidHpFagk8AbHt7.mp3')
[](video-1 'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Video/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4zfnoXzSB.ogg')
[](video-1 'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Video/0/ac35f3ad-4cbb-da07-e510-39fd24ba71b5/jseEvLjEA4JXbybZQse.mp4')";
// 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/