File tree Expand file tree Collapse file tree 1 file changed +18
-20
lines changed
extension/src/json-viewer Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Original file line number Diff line number Diff line change 5353// - Made starting path slash optional (http://example.com?foo=bar)
5454//
5555// - Allow a dot (.) at the end of hostnames (http://example.com.)
56- //
57- module . exports = new RegExp (
58- "^" +
59- // protocol identifier
60- "(?:(?:https?|ftp)://)" +
61- // user:pass authentication
62- "(?:\\S+(?::\\S*)?@)?" +
63- "(?:" +
64- // IPv6 or hybrid addresses
65- "(?:\\[[a-f0-9.:]+\\])" +
66- "|" +
67- // anything else, including IPv4 addresses
68- "(?:[a-z0-9\\u00a1-\\uffff.-]+)" +
69- ")" +
70- // port number
71- "(?::\\d{2,5})?" +
72- // resource path
73- "(?:[/?#]\\S*)?" +
74- "$" , "i"
75- ) ;
56+
57+ function relativePath ( ) {
58+ return "(?:[/?#]\\S*)?" ;
59+ }
60+
61+ function absolutePath ( ) {
62+ return "(?:(?:https?|ftp)://)" + /* protocol identifier*/
63+ "(?:\\S+(?::\\S*)?@)?" + /* user:pass authentication*/
64+ "(?:" +
65+ "(?:\\[[a-f0-9.:]+\\])" + /* IPv6 or hybrid addresses*/
66+ "|" +
67+ "(?:[a-z0-9\\u00a1-\\uffff.-]+)" + /* anything else, including IPv4 addresses */
68+ ")" +
69+ "(?::\\d{2,5})?" + /* port number*/
70+ relativePath ( ) ; /* resource path*/
71+ }
72+
73+ module . exports = new RegExp ( `^(${ absolutePath ( ) } |${ relativePath ( ) } )$` , "i" ) ;
You can’t perform that action at this time.
0 commit comments