added support for /r switch in regex replace