Regular test matches
//定义正则
var emailFormat=/^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/
//匹配正则
emailFormat.test('[email protected]')
Output: true
Regular extraction group, according to the extraction ()
//定义正则
var emailFormat=/^([a-zA-Z0-9]+)@[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/
//提取组
emailFormat.exec('[email protected]')
Output:
(2) ["[email protected]", "admin", index: 0, input: "[email protected]", groups: undefined]