str_replace_re

Function str_replace_re 

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

Replace the first and shortest occurrence 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(&"baab".into(), a_star, &"cc".into()), "ccbaab".into());

let a_plus = re_plus(str_to_re(&"a".into()));
assert_eq!(str_replace_re(&"baab".into(), a_plus, &"cc".into()), "bccab".into());

assert_eq!(str_replace_re(&"nomtch".into(), a_plus, &"cc".into()), "nomtch".into());