// 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"(?miu).{1,}?([。.」??!!]+|\n)").unwrap();
let string = " そこは純白の空間だった。
四方の壁は継ぎ目の無い白塗り、中央に鎮座する祭壇も雪を固めたように真っ白で、この部屋を満たす光もまた白く輝いていた。
「供物を捧げよ」
どこからとも無く部屋中に響き渡る声。
開け放たれた両開きの扉、その暗い通路の向こうから人の列がやってくる。白い部屋と同じように、その人々もまた白尽くめであった。
染み一つ無い清潔な白いローブで全身を覆い、顔には白いマスクを被り、素肌を露出している部分が一切無い。";
// 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/