-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.d.ts
33 lines (25 loc) · 905 Bytes
/
index.d.ts
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
export interface Options {
/**
Only match an exact string.
Useful with `RegExp#test` to check if a string is an email address.
@default false
*/
readonly exact?: boolean;
}
/**
Regular expression for matching email addresses.
Use it for finding email addresses or checking if something is email like. [You shouldn't use this for validating emails.](http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/) Only for hinting to the user.
@example
```
import emailRegex from 'email-regex';
// Contains an email address
emailRegex().test('unicorn [email protected]');
//=> true
// Is an email address
emailRegex({exact: true}).test('[email protected]');
//=> true
'unicorn [email protected] cake [email protected] rainbow'.match(emailRegex());
//=> ['[email protected]', '[email protected]']
```
*/
export default function emailRegex(options?: Options): RegExp;