// 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)(skip-if-active=")([^"]+)(")"#).unwrap();
let string = "<script skip-if-active=\"facebook-for-woocommerce/facebook-for-woocomerce.php\">
!(function (f, b, e, v, n, t, s) {
if (f.fbq) return;
n = f.fbq = function () {
n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = \"2.0\";
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s);
})(window, document, \"script\", \"https://connect.facebook.net/de_DE/fbevents.js\");
fbq(\"init\", \"{{fbPixelId}}\");
fbq(\"track\", \"PageView\");
</script>
<noscript><img height=\"1\" width=\"1\" alt=\"\" style=\"display: none;\" src=\"https://www.facebook.com/tr?id={{fbPixelId}}&ev=PageView&noscript=1\" /></noscript>";
let substitution = "";
// 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/