File tree Expand file tree Collapse file tree 1 file changed +26
-20
lines changed
extension/src/json-viewer Expand file tree Collapse file tree 1 file changed +26
-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 resourcePath ( ) {
58+ return "(?:[/?#]\\S*)?" ;
59+ }
60+
61+ function absolutePath ( ) {
62+ return "^" +
63+ // protocol identifier
64+ "(?:(?:https?|ftp)://)" +
65+ // user:pass authentication
66+ "(?:\\S+(?::\\S*)?@)?" +
67+ "(?:" +
68+ // IPv6 or hybrid addresses
69+ "(?:\\[[a-f0-9.:]+\\])" +
70+ "|" +
71+ // anything else, including IPv4 addresses
72+ "(?:[a-z0-9\\u00a1-\\uffff.-]+)" +
73+ ")" +
74+ // port number
75+ "(?::\\d{2,5})?" +
76+ // resource path
77+ resourcePath ( ) +
78+ "$" ;
79+ }
80+
81+ module . exports = new RegExp ( `${ absolutePath ( ) } |${ resourcePath ( ) } ` , "i" ) ;
You can’t perform that action at this time.
0 commit comments