// 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).*SYSLOG_ROW\]\s*(.*,\s*)?").unwrap();
let string = "2019-06-28 15:02:09:933 - info: [bUSLog] [bUS_SYSLOG_ROW] Jun 28 11:02:09 device—Target ABC-DEF[365] Notice: -[sendAllDataToServerWithDebug:] [Line 255] Event uploaded, ABCAccount : {
2019-06-28 15:02:09:933 - info: [bUSLog] [bUS_SYSLOG_ROW] dcis = 0;
2019-06-28 15:02:09:933 - info: [bUSLog] [bUS_SYSLOG_ROW] ttl = 0;
2019-06-28 15:02:09:933 - info: [bUSLog] [bUS_SYSLOG_ROW] bb = 0;
2019-06-28 15:02:09:933 - info: [bUSLog] [bUS_SYSLOG_ROW] r1 = 1234567890;
2019-06-28 15:02:09:934 - info: [bUSLog] [bUS_SYSLOG_ROW] pop = abc;
2019-06-28 15:02:09:934 - info: [bUSLog] [bUS_SYSLOG_ROW] origin = target;
2019-06-28 15:02:09:934 - info: [bUSLog] [bUS_SYSLOG_ROW] \"tsn\" = “l323f123f”;
2019-06-28 15:02:09:934 - info: [bUSLog] [bUS_SYSLOG_ROW] }
2019-06-28 15:02:09:934 - info: [bUSLog] [bUS_SYSLOG_ROW] Jun 28 11:02:09 device—Target ABC-DEF[365] Notice: -[sendAllDataToServerWithDebug:] [Line 255] Event uploaded, ABCAccount : {
2019-06-28 15:02:09:935 - info: [bUSLog] [bUS_SYSLOG_ROW] dcis = 0;
2019-06-28 15:02:09:935 - info: [bUSLog] [bUS_SYSLOG_ROW] ttl = 0;
2019-06-28 15:02:09:935 - info: [bUSLog] [bUS_SYSLOG_ROW] bb = 0;
2019-06-28 15:02:09:935 - info: [bUSLog] [bUS_SYSLOG_ROW] r1 = NA;
2019-06-28 15:02:09:935 - info: [bUSLog] [bUS_SYSLOG_ROW] pop = abc;
2019-06-28 15:02:09:936 - info: [bUSLog] [bUS_SYSLOG_ROW] origin = source;
2019-06-28 15:02:09:936 - info: [bUSLog] [bUS_SYSLOG_ROW] \"tsn\" = “lasdf23f23”;
2019-06-28 15:02:09:936 - info: [bUSLog] [bUS_SYSLOG_ROW] }
2019-06-28 15:02:09:936 - info: [bUSLog] [IOS_SYSLOG_ROW] Jun 28 11:02:09 device—Target ABC-DEF[365] Notice: -[sendAllDataToServerWithDebug:] [Line 255] Event uploaded, ABCAdditional : {
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] add1 = value;
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] add2 = false;
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] pop = abc;
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] origin = target;
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] “tsn” = “g254g34gg4g”;
2019-06-28 15:02:09:937 - info: [bUSLog] [IOS_SYSLOG_ROW] \"time_zone\" = EDT;
2019-06-28 15:02:09:938 - info: [bUSLog] [IOS_SYSLOG_ROW] }";
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/