// 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"(position|top|left|bottom|right):\s?(\w*);").unwrap();
let string = "background-image: url(http://host.ru:8080/img/environment/circle_portret2.jpg); position: absolute; top: 73px; left: 93px; background-position: 0px 0px; background-repeat: initial initial; ";
// 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/