parseUri
General
This function splits any well-formed URI into its parts (all are optional). All parts are split with a single regex using backreferences, and all groupings which don't contain complete URI parts are non-capturing.
Notes
- Created by: Steven Levithan
- Web Site: stevenlevithan.com
- Posted: October 24, 2008
Highlights
- Comprehensively splits URIs, including splitting the query string into key/value pairs.
- Two parsing modes: loose and strict.
- Offers convenient, pre-concatenated components (path = directory and file; authority = userInfo, host, and port; etc.)
- Change the default names of URI parts without editing the function, by updating parseUri.options.key.
Blog post
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: parseuri.js
Head
Paste this code into the HEAD section of your HTML document.


Leave a Response
(0 comments)