Fix incorrect boundary condition
Add `\g{N}` for &Regex.replace/4
Document `\g{N}`
Merge pull request #2933 from Kabie/Regex.replace

Fix and enhance &Regex.replace/4