// 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"(?mi)(\w+\s+)(\w+\?*\s+)(\w+)\s+(\{.+\})").unwrap();
let string = "public Guid DellUploadItemID { get; set; }
public Guid UploadID { get; set; }
public string DellPurchaseID { get; set; }
public string PoNum { get; set; }
public string OrderNum { get; set; }
public string OrderType { get; set; }
public string InvoiceNum { get; set; }
public string PaymentDescription { get; set; }
public DateTime? OrderDate { get; set; }
public DateTime? ShippedDate { get; set; }
public DateTime? InvoiceDate { get; set; }
public decimal ReportLineTotal { get; set; }
public string ServiceTag { get; set; }
public string Category { get; set; }
public string SubCategory { get; set; }
public string Item { get; set; }
public string ItemLongName { get; set; }
public DateTime? WarrantyEndDate { get; set; }
public string ShipFirstName { get; set; }
public string ShipLastName { get; set; }
public string ShipToCompany { get; set; }
public string ShipAddress1 { get; set; }
public string ShipAddress2 { get; set; }
public string ShipCity { get; set; }
public string ShipState { get; set; }
public string ShipZip { get; set; }
public string ShipMethod { get; set; }
public string CarrierName { get; set; }
public string WaybillNumber { get; set; }
public string ExpressServiceCode { get; set; }
public string MACAddress { get; set; }
public string MACAddress2 { get; set; }";
let substitution = "\\3 = d.\\3,";
// 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/