// 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{2}:\d{2}:\d{2}[.,]\d{3})\s-->\s(\d{2}:\d{2}:\d{2}[.,]\d{3})\n(.*(?:\r?\n(?!\r?\n).*)*)").unwrap();
let string = "WEBVTT
1
00:00:00.310 --> 00:00:02.540
Dans cette séquence, nous
allons voir pourquoi nos
2
00:00:02.550 --> 00:00:05.210
assistants personnels,
smartphones et tablettes, sont
3
00:00:05.210 --> 00:00:07.420
devenus tout
naturellement, en une dizaine d'années
4
00:00:07.420 --> 00:00:10.100
seulement, un point de collecte
majeur de données personnelles.
5
00:00:10.520 --> 00:00:13.140
Pourquoi le smartphone
intéresse-t-il tant de monde ?
6
00:00:15.690 --> 00:00:17.550
Tout d'abord, il faut
être conscient que dans un
7
00:00:17.550 --> 00:00:20.110
smartphone, 2 niveaux
existent. Il y a la partie visible
8
00:00:20.150 --> 00:00:23.440
avec son processeur dont on
va vanter les performances,
9
00:00:23.440 --> 00:00:26.260
le système d'exploitation
- dans ce module, nous nous";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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/