r"
^(?:(?P<protocol>http[s]?|ftp)(?::\/\/))?\/?(?P<address>(?P<hostname>[^\/\.]+)*?(?:\.)?(?P<domain>[^\/\.]+(?:\.[^:\/\s\.]+(\.[^:\/\s\.]+){0,1})?))(:\d+)?(?:$|\/)(?P<fullpath>(?P<path>[^#?\s]*?)(?:\/(?P<name>[^#?\/\s]*))?)(?:\?(?P<arg>.*?))?(?:#(?P<anchor>[\w\-]+))?$
"
mg