// 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)(?<![\u4E00-\u9FAF\u3040-\u3096\u30A1-\u30FA\uFF66-\uFF9D\u31F0-\u31FF])(?<!\d)(?<!\d\.)(\d+(?:\.\d+)?m2)").unwrap();
let string = "\"110.94m2・129.24m2\";
--> 110.94m2 and 129.24m2
\"81.95m2(24.78坪)、うち2階車庫8.9m2\"
--> 81.95m2
\"80.93m2(登記)\"
--> 80.93m2
\"93.42m2・93.85m2(登記)\"
--> 93.42m2 and 93.85m2
\"81.82m2(実測)\"
--> 81.82m2
\"81.82m2(実測)、うち1階車庫7.82m2\"
--> 81.82m2
\"90.11m2(実測)、うち1階車庫8.07m2\"
--> 90.11m2";
// 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/