declare class RegExpUri extends RegExp { options: RegExpUri.Options; constructor(options?: Partial<{ preset: keyof typeof RegExpUri.presets; } & RegExpUri.Options> | RegExpUri, flags?: string); exec(string: string): RegExpExecArray | null; } declare namespace RegExpUri { type Options = { /** * A whitelist or a blacklist of schemes. * * Default: `{ disallow: [] }`. */ schemes: Whitelist | Blacklist; /** * A whitelist or a blacklist of domains. * * Default: `{ disallow: [] }`. */ domains: Whitelist | Blacklist; /** * Whether the scheme part must be present. `undefined` allows both cases. * * [RFC3986 ***does*** require](https://datatracker.ietf.org/doc/html/rfc3986#section-3), so setting this option to `"never"` or `undefined` shall get you out of the legal syntax of URI. * * Default: `"always"`. */ requireScheme: "always" | "never" | undefined; /** * Whether the double slash must be present, when the scheme part is missing but the authority part is present. `undefined` allows both cases. This setting is only meaningful when `requireScheme` is `"never"` or `undefined. * * [RFC3986 ***does*** require it as long as the authority part is present](https://datatracker.ietf.org/doc/html/rfc3986#section-3), so setting this option to `"never"` or `undefined` shall get you out of the legal syntax of URI. * * Default: `"always"`. */ requireDoubleSlash: "always" | "never" | undefined; /** * Whether the authority part must be present. `undefined` allows both cases. * * Default: `undefined`. */ requireAuthority: "always" | "never" | undefined; /** * Whether to use [RFC1034 3.5. Preferred name syntax](https://datatracker.ietf.org/doc/html/rfc1034#section-3.5). * * Default: `false`. */ usePreferredDomainNameSyntax: boolean; /** * Whether to verify given domain name has a well-known TLD in the IANA's list. Only meaningful when `usePreferredDomainNameSyntax` is `true`. * * Default: `false`. */ allowKnownTldsOnly: boolean; /** * Whether URIs can be relative reference. * * Default: `true`. */ allowRelative: boolean; /** * Whether to allow the query part to be without its content. * * Default: `true`. */ allowEmptyQuery: boolean; /** * Whether to allow the fragment part to be without its content. * * Default: `true`. */ allowEmptyFragment: boolean; /** * Allows matching to empty string. * * Default: `false`. */ allowEmpty: boolean; /** * Enables exact match pattern. It wraps the `RegExp` pattern with `^` and `$`. * * Default: `false`. */ exact: boolean; /** * Enables named capture groups. See {@link NamedCaptureGroups `RegExpUri.NamedCaptureGroups`} to know what's in the box. * * `"outmost"` should fit for some usage e.g. splitting a plaintext by URIs using [`String.prototype.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split). * * Default: `"all"` if `exact` is `true`, `"outmost"` otherwise. */ groups: "all" | "outmost" | "none"; }; type NamedCaptureGroups = { uri: string; scheme: string | undefined; authority: string | undefined; userinfo: string | undefined; host: string | undefined; port: string | undefined; path: string | undefined; query: string | undefined; fragment: string | undefined; }; type Whitelist = { allow: T[]; disallow?: never; }; type Blacklist = { allow?: never; disallow: T[]; }; const presets: { readonly canonical: Omit; readonly convenient: Omit; }; } export default RegExpUri;