email(email: string): {
include: boolean,
matchs: RegExpMatchArray | null,
groups: Array<{ user: string, domain: string } | null> | null
}
Search e-mail in a string:
const { web } = require('regex-simplify');
const email = web.email(`
lama.loca.loca123@inca.com
test@test.co.uk
test @ outlook.com
`);
console.log(email);
And here what return the function:
{
include: true,
matchs: [ 'lama.loca.loca123@inca.com', 'test@test.co.uk' ],
groups: [
[Object: null prototype] {
user: 'lama.loca.loca123',
domain: 'inca.com'
},
[Object: null prototype] { user: 'test', domain: 'test.co.uk' }
]
}
Last updated