// 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"(?ix)(?# Patrón de nombre multivariado)
\bJorge\s+((Alberto|A\.?)\s+)?/?(?P<Apellido>G[óo]mez)(\s+(Prada|P\.?))?\b").unwrap();
let string = "(1)Jorge Alberto Gómez Prada = (2)Jorge Gómez = (3)Jorge A Gómez = (4)Jorge A. Gómez P.
(5)(Jorge GOMEZ P.a) ... (6)Alberto jorge GÓMEZ (7)Jorge /Gómez
(8)>>Jorge A
Gómez P<< (9)Jorge Gómez Pradas (10)JJorge Gómez (11) Luis Jorge Gómeza";
let substitution = "Amparo \\g<Apellido>";
// 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/