// 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"([^ ]+ ){0,4}(?:qyw4)( [^ ]+){0,5}").unwrap();
let string = "12 That led them by the right hand of Moses with his glorious arm, dividing the water before them, to qyw4 make himself an everlasting name? 13 That led them through the deep, as an horse in the wilderness, that they should not stumble? 14 As a beast goeth down into the valley, the Spirit of the LORD caused him to rest: so didst thou lead thy people, to make thyself a glorious name.
15 Look down from heaven, and behold from the qyw4 habitation of thy holiness and of thy glory: where is thy zeal and thy strength, the sounding of thy bowels and of thy mercies toward me? are they restrained? ";
let substitution = "love $1$2 unny\\r\\r";
// 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/