Removing duplicate regexpEscape function