// 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"(?ms)BEGIN:VEVENT.*?END:VEVENT").unwrap();
let string = "BEGIN:VEVENT
DTSTAMP:20220301T023567Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20210630T110000
DTEND;TZID=Asia/Tokyo:20210630T160000
DESCRIPTION:\\n--------\\n同日入替 : false\\n前回ゲスト数 : 1\\n次
SUMMARY: xxxxx (xxx / xxx xxx
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20221105T072143Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20210501T110000
DTEND;TZID=Asia/Tokyo:20210701T160000
DESCRIPTION:\\n--------\\n同日入替 : false\\n前回ゲスト数 : 1\\n次
SUMMARY: xxx (xxx / xxx xxx)
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20220905T023143Z
UID: xxx
DTSTART;TZID=Asia/Tokyo:20220227T110000
DTEND;TZID=Asia/Tokyo:20220227T160000
DESCRIPTION:\\n--------\\n同日入替 : true\\n前回ゲスト数 : 2\\n次回
SUMMARY:★ xxx (xxx / xxx xxx)
END:VEVENT";
// 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/