Added test cases
Fixed escapes in replacement