Created
          June 5, 2024 13:23 
        
      - 
      
- 
        Save oharsta/9095782782e4e184b24c47d86a20a39d to your computer and use it in GitHub Desktop. 
    JS mail regular expression
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const mailRegExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.?[a-zA-Z]*$/; | |
| mailRegExp.test("a@a") | |
| // true | |
| mailRegExp.test("a!@a") | |
| // false | |
| mailRegExp.test("a!@a/x") | |
| // false | |
| mailRegExp.test("[email protected]") | |
| // true | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment