parseUri splits any URI into its parts, all of which are optional.

There are two parsing modes: loose (the default, which is meant to be used when working with user input, and is better at reading your mind), and strict (which attempts to split URIs according to RFC 3986). In loose mode, directories don't need to end with a slash (e.g., the "dir" in "/dir?query" is treated as a directory rather than a file name), and the URI can start with an authority without being preceded by "//" (which means that the "" in "" is treated as the host, rather than part of the directory path). For more information, see the related blog post.

Note that by design, this function does not attempt to validate the URI it receives, as that would limit its flexibility.




Color-Coded Output:

Results List

Hover over each URI part to identify it.


Loose Mode

Strict Mode