// 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)\-\-(.*):(.*)").unwrap();
let string = "--font-heading: {{ settings.header_font_1_1.family }};
--font-standard: {{ settings.general_font_1_1.family }};
--body-font-size: {{settings.body_font_size}}px;
--font-small: 14px;
--font-medium: 17px;
--font-bold: 300;
--size-h1: {{settings.heading_size_1}}px;
--size-h2: {{settings.heading_size_2}}px;
--size-h3: {{settings.heading_size_3}}px;
--size-h4: {{settings.heading_size_4}}px;
--size-h5: {{settings.heading_size_5}}px;
--size-h6: {{settings.heading_size_6}}px;
--top-font-size: {{settings.top_bar_size}}px;
--product-font-size: {{settings.product_title_size}}px;
--product-price-size: {{settings.product_price_size}}px;
--footer-size: {{ settings.footer_font_size }}px;
{% comment %} --home-title-font-size: {{settings.home_title_size}}px; {% endcomment %}
--product-detail-title-size: {{settings.product_detail_title_size}}px;
--font-icon : 20px;
--font-small-icon: 21px;";
let substitution = "$2";
// 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/