// 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":(?=([^']*'[^']*')*[^']*$)").unwrap();
let string = "select id, :DATA_INI, ':DATA_INI', titulo,
date_format(data_criacao,'%d/%m/%Y %H:%i') str_data_criacao
from v$sugestoes
where data_criacao between :DATA_INI AND :DATA_FIM AND ':TEST'
and 'test ''string :DATA_INI '' :DATA_INI '
order by data_criacao";
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/