Do a regular expression replace instead of exact string search and replace

Seems to fix the SET_DNS issue where we were doing a regex search and pattern replace.