Open
Description
Using a _
in the replacement string of Regex::replace
leads to unexpected behaviour. The _
seems to be treated as a backspace. The documentation should either make mention of this, or this seems to be a bug.
#[test]
fn replacement_with_underscore() {
let re = regex!(r"(.)(.)");
let s1 = re.replace("ab","$1-$2");
let s2 = re.replace("ab","$1_$2");
assert_eq!("a-b", &s1);
assert_eq!("a_b", &s2); // Fails here "a_b" != "b"
}