URLParse

URLParse["url"]
takes a well-formed URL and gives an association whose values correspond to the components of the URL.

URLParse["url","component"]
returns only the specified component.

URLParse["url",{component1,component2,}]
returns only the specified component list.

Details and OptionsDetails and Options

  • Possible components extracted by URLParse include:
  • "Scheme"URL scheme (appearing at the beginning)
    "User"user information
    "Domain"domain name or host
    "Port"port number (appearing after :)
    "Path"path list (separated by /)
    "PathString"complete path as a string
    "AbsoluteDomain"complete domain as a string, including scheme
    "AbsolutePath"complete path as a string, including scheme and domain
    "Query"list of parameter-value pairs (appearing after ?)
    "QueryString"complete query string
    "Fragment"fragment (appearing after #)
  • If a particular component is not present in the URL, the value returned for that component is None.
  • A component, if present, is returned as an integer.
  • A trailing / in the path component of the URL is represented by a last element in the component returned by URLParse.
  • URLParse["url"] returns an Association containing the following sequence of keys: , , , , , , .
  • URLParse[{"url1","url2",},] gives results for a list of URLs.
  • URLParse has option CharacterEncoding, which specifies the encoding of character codes to assume in the URL. The default is .

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Parse a URL into its components:

In[5]:=
Click for copyable input
Out[5]=

Parse only path and query:

In[1]:=
Click for copyable input
Out[1]=

URLParse is Listable:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)