// 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)(,\d{3}$)").unwrap();
let string = "1
00:00:06,000 --> 00:00:12,074
- = www.OpenSubtitles.org = -
2
00:01:35,623 --> 00:01:38,208
Apollo Três aqui.
Houston, você pode me copiar?
3
00:01:39,168 --> 00:01:41,378
Apollo Três, aqui é Houston.
Voce me ouve
4
00:01:41,503 --> 00:01:43,797
Bem recebido, de Houston.
Apollo Três aqui.
5
00:01:44,340 --> 00:01:48,385
Apollo Três, está tudo bem aqui.
6
00:01:49,428 --> 00:01:52,973
- Lee, você pode me copiar?
- Você é recebido, Capcom. Que falador.";
let substitution = "$1\\n<font color=#FFFF00>";
// 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/