tag : URI.js

The Lazy Man's URL Parsing in JavaScript

Have you ever needed to parse a URL using regular expressions? It’s not easy to write regular expressions (for a lot of people, including myself) and it’s even tougher to test to see if that regular expression is reliable across every situation. You could, of course, just copy and paste a regular expression (or function or library) that someone else developed and use that, but I propose that there is a simpler and more concise way of parsing URLs that doesn’t require any regular expressions.