// 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#"(?x)(?mixs)1-ASCII:(?#Literales ASCII)\n
1\.1-Los\ 95\ caracteres\ ASCII\ imprimibles:\n
\ ! \" \# \$ % & ' \( \) \* \+ , - \. /\n
0123456789 :;<=> \? @\n
ABCDEFGHIJKLMNOPQRSTUVWXYZ \[ \\ ] \^ _ `\n
abcdefghijklmnopqrstuvwxyz { \| }~ \~ \n
1\.2-Algunos\ ASCII\ extendidos: áÁàÀäÄâÂéíóú\nñÑ\tÿ\
2-Algunos\ Unicode\ no\ no\ ASCII:∫∬∭∰\u2230"#).unwrap();
let string = "1-ASCII:
1.1-Los 95 caracteres ASCII imprimibles:
!\"#$%&'()*+,-./
0123456789:;<=>?@
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`
abcdefghijklmnopqrstuvwxyz{|}~~
1.2-Algunos ASCII extendidos:áÁàÀäÄâÂéíóú
ñÑ ÿ
2-Algunos Unicode no no ASCII:∫∬∭∰∰";
// 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/