// 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".+enviado;(.+@.+);;.+").unwrap();
let string = "0;enviado;0f3z4zufu@gmail.com;;Enviado ->23/01/2015 09:07:37
0;enviado;10anadri@gmail.com;;Enviado ->23/01/2015 09:07:37
0;enviado;1438.cesar@bradesco.com.br;;Enviado ->23/01/2015 09:07:37
0;enviado;1438.elicleide@bradesco.com.br;;Enviado ->23/01/2015 09:07:38
0;enviado;1459.andre@bradesco.com.br;;Enviado ->23/01/2015 09:07:38
0;enviado;16edson@uol.com.br;;Enviado ->23/01/2015 09:07:38
0;enviado;1_029@hotmail.com;;Enviado ->23/01/2015 09:07:39
0;enviado;2010@gmail.com;;Enviado ->23/01/2015 09:07:39
0;enviado;222lbuquerque@ibest.com.br;;Enviado ->23/01/2015 09:07:40
0;enviado;2628.gerencia@bradesco.com.br;;Enviado ->23/01/2015 09:07:40
0;enviado;2mrdesign@gmail.com;;Enviado ->23/01/2015 09:07:41
0;enviado;3alfa@uol.com.br;;Enviado ->23/01/2015 09:07:41
0;enviado;3dmetalurgica@gmail.com;;Enviado ->23/01/2015 09:07:42";
let substitution = "\\1";
// 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/