// 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"<!--\[[^\]]*(?:](?!-->)[^\]]*)*]-->\R?").unwrap();
let string = "<link rel=File-List href=\"filelist.xml\">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>3</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2014-02-14T21:30:00Z</o:Created>
<o:LastSaved>2014-02-14T21:35:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>58</o:Words>
<o:Characters>331</o:Characters>
<o:Lines>2</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>388</o:CharactersWithSpaces>
<o:Version>15.00</o:Version>
</o:DocumentProperties>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<link rel=themeData href=\"themedata.tx\">";
let substitution = "";
// result will be a String with the substituted value
let result = regex.replace(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/