You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
729 B

var RFC3986 = require('./rfc3986');
var internals = {
Uri: {
createUriRegex: function (optionalScheme) {
var scheme = RFC3986.scheme;
// If we were passed a scheme, use it instead of the generic one
if (optionalScheme) {
// Have to put this in a non-capturing group to handle the OR statements
scheme = '(?:' + optionalScheme + ')';
}
/**
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
*/
return new RegExp('^' + scheme + ':' + RFC3986.hierPart + '(?:\\?' + RFC3986.query + ')?' + '(?:#' + RFC3986.fragment + ')?$');
}
}
};
module.exports = internals.Uri;