// 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#"("name":"[^"]+")|("price":(?:\d{1,3}.?)+[.,]\d{1,2})"#).unwrap();
let string = "[{\"productsShelf\":[],\"productsDetail\":[{\"position\":\"1\",\"name\":\"Placa-M�e ASUS p/ Intel LGA 1151 ATX ROG STRIX Z270E GAMING,DDR4,Aura Sync, �udio Gamer, Rede Intel, SLI/CFX, Wi-Fi, USB 3.1 Frontal,HDMI/DP\",\"category\":\"Hardware/Placas-m�e/P/ Processador Intel/ASUS\",\"brand\":\"Asus;\",\"price\":1095.9,\"id\":\"84264\",\"available\":true}],\"visitor\":\"\",\"pageType\":\"product\",\"breadcrumb\":[{\"url\":\"http://www.kabum.com.br/hardware\",\"name\":\"Hardware\"},{\"url\":\"http://www.kabum.com.br/hardware/placas-mae\",\"name\":\"Placas-m�e\"},{\"url\":\"http://www.kabum.com.br/hardware/placas-mae/p-processador-intel\",\"name\":\"P/ Processador Intel\"},{\"url\":\"http://www.kabum.com.br/hardware/placas-mae/p-processador-intel/asus\",\"name\":\"ASUS\"}]}];";
// 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/