// 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)(.*)(Itemid=)(?!527)([1-9]*)").unwrap();
let string = "/docman/?view=document&alias=690-uchwala-rady-miasta-nr-xv-100-2015-zmieniajaca-uchwale-nr-xxxiii-151-2012&category_slug=gminne-programy-i-strategie&Itemid=123
/docman/?view=document&alias=690-uchwala-rady-miasta-nr-xv-100-2015-zmieniajaca-uchwale-nr-xxxiii-151-2012&category_slug=gminne-programy-i-strategie&Itemid=494
/docman/?view=document&alias=690-uchwala-rady-miasta-nr-xv-100-2015-zmieniajaca-uchwale-nr-xxxiii-151-2012&category_slug=gminne-programy-i-strategie&Itemid=527";
let substitution = "$1${2}494";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", result);
}
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/