// 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)((\b\p{Upper}\w+)|(\b\p{Upper}\w{1,5}\.)) ?( ((\b\p{Lower}{1,6})|(\b\p{Upper}\w+)|((\b\p{Upper}\w{1,5}\.)))){0,4} v\.? ((\b\p{Upper}\w+)|(\b\p{Upper}\w{1,5}\.)) ?( ((\b\p{Lower}{1,6})|(\b\p{Upper}\w+)|((\b\p{Upper}\w{1,5}\.)))){0,4}").unwrap();
let string = "This is not a case. But this is: Riley v. California. And riley v. california also isn't.
Riley v. California and Mapp v. Ohio \"United Zinc & Chemical Co. v. Britt\" should all count, but not MAPP V. OHIO!
Both R.A. Peacock v. Lubbock Compress Company and Battalla v. State of New York have complex names.
But also, Craggan v. IKEA USA and this Case: Edwards v. Honeywell, Inc..";
// 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/