Skip to content

Instantly share code, notes, and snippets.

View bvisonl's full-sized avatar
🚀
From outta space

Benjamín Visón bvisonl

🚀
From outta space
View GitHub Profile
function parseUri(s) {
if(typeof s === 'object')
return s;
var re = /^\<?(sips?):(?:([^\s>:@]+)(?::([^\s@>]+))?@)?([\w\-\.]+)(?::(\d+))?((?:;[^\s=\?>;]+(?:=[^\s?\;]+)?)*)(?:\?(([^\s&=>]+=[^\s&=>]+)(&[^\s&=>]+=[^\s&=>]+)*))?$/;
var r = re.exec(s);
if(r) {
return {