mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 10:49:00 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
		
			429 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			429 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * Matches an a string to an email pattern
 | |
|  * @type {RegExp}
 | |
|  */
 | |
| const emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/g;
 | |
| 
 | |
| /**
 | |
|  * Checks that a candidate string is an email
 | |
|  * @param candidateEmail {string}
 | |
|  * @return {boolean}
 | |
|  */
 | |
| export default (candidateEmail: string): boolean => emailRegex.test(String(candidateEmail));
 | 
