Use a RegEx to do this and factor it out in a different method that sanitizes the URL