modified all 'replace' to use regular expressions