summaryrefslogtreecommitdiff
path: root/bin/wiki/ImportarDesdeURL/node_modules/url-regex/index.d.ts
blob: f29a2430b4d371cbe77c2776d22fcf724a06d0dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
declare namespace urlRegex {
	interface Options {
		/**
		Only match an exact string. Useful with `RegExp#test` to check if a string is a URL.

		@default false
		*/
		readonly exact?: boolean;

		/**
		Force URLs to start with a valid protocol or `www`. If set to `false` it'll match the TLD against a list of valid [TLDs](https://github.com/stephenmathieson/node-tlds).

		@default true
		*/
		readonly strict?: boolean;
	}
}

/**
Regular expression for matching URLs.

@example
```
import urlRegex = require('url-regex');

urlRegex().test('http://github.com foo bar');
//=> true

urlRegex().test('www.github.com foo bar');
//=> true

urlRegex({exact: true}).test('http://github.com foo bar');
//=> false

urlRegex({exact: true}).test('http://github.com');
//=> true

urlRegex({strict: false}).test('github.com foo bar');
//=> true

urlRegex({exact: true, strict: false}).test('github.com');
//=> true

'foo http://github.com bar //google.com'.match(urlRegex());
//=> ['http://github.com', '//google.com']
```
*/
declare function urlRegex(options?: urlRegex.Options): RegExp;

export = urlRegex;