Profile
Achievement
Sephr's Recent SnippetsTagged html5
- All /
« Prev 1 Next »
Use this to extract an HTML5 origin from a URI. $1 is the origin.
The square brackets are there to support IPv6 addresses.
Example:
var html5OriginRegex = /^([\w-]+:\/*\[?[\w\.:-]+\]?(?::\d+)?).*/;
"http://www.google.com:42/foo/bar/...
0
586
posted 15 years ago by Sephr