Improve regex text replacement test