version 1.0.0 (1.59 KB) by Emmanuel Farhi
parse a URL and return its components


Updated 21 Jun 2021

View License

This small utility is an URI/URL decoder. Given a string, it returns a structure with parts composing the URI, according to https://en.wikipedia.org/wiki/Uniform_Resource_Identifier
A URI syntax is:
  • URI = scheme:[//authority]path[?query][#fragment]
where authority can be [userinfo@]host[:port].
For instance :
url1 = 'https://www.mathworks.com/matlabcentral/fileexchange/?term=example#total_results_az_footer';
res = urlParse(url1);
res =
scheme: 'https:'
authority: '//www.mathworks.com'
path: '/matlabcentral/fileexchange/'
query: '?term=example'
fragment: '#total_results_az_footer'

Cite As

Emmanuel Farhi (2022). urlParse (https://www.mathworks.com/matlabcentral/fileexchange/94545-urlparse), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!