// 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)(/sites(?:/[^/\"]+){2}/SitePages/[^/\"]+)\.aspx(?=\")"#).unwrap();
let string = "<div class=\"ms-wikicontent ms-rtestate-field\" style=\"padding-right: 10px\"><div class=\"ExternalClass8E56354CC4314DBA861E187B689F3A2B\"><table id=\"layoutsTable\" style=\"width:100%\"><tbody><tr style=\"vertical-align:top\"><td style=\"width:100%\"><div class=\"ms-rte-layoutszone-outer\" style=\"width:100%\"><div class=\"ms-rte-layoutszone-inner\" role=\"textbox\" aria-haspopup=\"true\" aria-autocomplete=\"both\" aria-multiline=\"true\"><a id=\"0::Home|Home\" class=\"ms-wikilink\" href=\"/sites/Team/Project/SitePages/Home.aspx\">Home</a> - <a id=\"1::Jenkins|Jenkins\" class=\"ms-wikilink\" href=\"/sites/Team/Project/SitePages/Jenkins.aspx\">Jenkins</a><h1 class=\"ms-rteElement-H1\">Jenkins Integration with Deployment Tools</h1>";
let substitution = "$1.html";
// 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/