Merge pull request #309 from aubrey-b/email-check
Check for a valid email.
This commit is contained in:
		| @ -1,5 +1,7 @@ | ||||
| using System.Globalization; | ||||
| using System; | ||||
| using System.Globalization; | ||||
| using System.Text; | ||||
| using System.Text.RegularExpressions; | ||||
|  | ||||
| namespace Oqtane.Shared | ||||
| { | ||||
| @ -217,5 +219,15 @@ namespace Oqtane.Shared | ||||
|                 return ""; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public static bool IsValidEmail(string email) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(email)) return false; | ||||
|  | ||||
|             return Regex.IsMatch(email, | ||||
|                   @"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + | ||||
|                   @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-0-9a-z]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$", | ||||
|                   RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker