Extended Regular Expressions (/x)

m{
  ^(http|https|ftp):    # scheme
  //([^/]*?:[^/]*?@)?   # username:password
  ([^/]*?)              # hostname
  (/[^?#]*?)            # pathname
  (\?[^#]*?)?           # query string
  (\#.*)?               # fragment
  $
}x