Enhanced regex replace for address and api key