str_replace_re_all

Function str_replace_re_all 

Source
pub fn str_replace_re_all(
    s1: &SmtString,
    r: RegLan,
    s2: &SmtString,
) -> SmtString
Expand description

Replace all non-empty matches of r by s2 in s1

ยงExample

use aws_smt_strings::smt_regular_expressions::*;

let a_star = re_star(str_to_re(&"a".into()));
assert_eq!(str_replace_re_all(&"baab".into(), a_star, &"cd".into()), "bcdcdb".into());

let digits = re_plus(re_range(&"0".into(), &"9".into()));
let pattern = re_concat(str_to_re(&"pre".into()), digits);
assert_eq!(str_replace_re_all(&"10pre129prepre0xx".into(), pattern, &"Z".into()),
           "10Z29preZxx".into());