Welcome To Snipplr
Everyone's Recent Regular Expression Snippets Tagged html5
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
« 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
455
posted 15 years ago by Sephr
« Prev 1 Next »