// 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" \r?\n {24}").unwrap();
let string = "RAW DATA
26/11/15 26/11/15 1314 NEFT : CMS364134568 - CRE
DIT CARD OPERATIONS
26/11/15 26/11/15 1314 Cash Deposit
27/11/15 27/11/15 1314 NEFT : CMS364860637 - CRE
DIT CARD OPERATIONS
27/11/15 27/11/15 1314 Cash Deposit
30/11/15 30/11/15 1314 NEFT : CMS365476895 - CRE
DIT CARD OPERATIONS
30/11/15 30/11/15 1314 NEFT : CMS365573866 - CRE
DIT CARD OPERATIONS
30/11/15 30/11/15 1314 NEFT : CMS365623059 - CRE
DIT CARD OPERATIONS";
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/