// 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"\[\[Image:[^]]+link=[^]]+]]").unwrap();
let string = "$t = [[Image:United Kingdom images gbr image031 jpg.png|141px|link=HomePage|United Kingdom images gbr image031 jpg.png]]
[[Image:United Kingdom images gbr image030 jpg.png|141px|United Kingdom images gbr image030 jpg.png]]
[[Image:United Kingdom images gbr image031 jpg.png|141px|link=Contact|United Kingdom images gbr image031 jpg.png]];
<span class=\"United Kingdomtemplate_colour\">Additional remarks</span><br> <br> Green sign with white and yellow text with blue plate with white text displaying that the indicated direction(s) lead to a motorway. [[Image:United Kingdom images gbr image031 jpg.png|141px|link=Home Page|United Kingdom images gbr image031 jpg.png]]<br>White sign with black text with blue plate with white text displaying that the indicated direction(s) lead to a motorway. [[Image:United Kingdom images gbr image046 jpg.png|292px|United Kingdom images gbr image046 jpg.png]]<br> <br> <span style=\"vertical-align: top;\">White sign with black text with blue plate with white text displaying that the indicated direction(s) lead to a motorway. </span> [[Image:United Kingdom images gbr image2550 jpg.png|368px|United Kingdom images gbr image2550 jpg.png|link=Contact]]";
let substitution = "[noinclude]$0[/noinclude]";
// 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/