Closed
Description
This used to work:
assert_eq!(Regex::new("(.)").unwrap().replace_all("a", "$1_"), "a_" );
But now produces "" instead of "a_".
It would appear that underscores somehow cause the replacement to be deleted instead of added.
Named captures don't fix it:
assert_eq!(Regex::new("(?P<char>.)").unwrap().replace_all("a", "$char_"), "a_" ); //actual: ""
But inserting a space between the capture and underscore works!
assert_eq!(Regex::new("(.)").unwrap().replace_all("a", "$1 _"), "a _" );
assert_eq!(Regex::new("(?P<char>.)").unwrap().replace_all("a", "$char _"), "a _" );
As does using curly braces around the identifier (the only apparent workaround)
assert_eq!(Regex::new("(?P<char>.)").unwrap().replace_all("a", "${char}_"), "a_" );