Skip to content
This repository was archived by the owner on Aug 18, 2024. It is now read-only.

Commit e158bb6

Browse files
committed
Reverted change to email validation check
1 parent d0a3203 commit e158bb6

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
using System;
2-
using System.Net.Mail;
1+
using System.Text.RegularExpressions;
32

43
namespace Lowscope.AppwritePlugin.Utils
54
{
65
public static class WebUtilities
76
{
8-
// Very basic validation check
97
public static bool IsEmailValid(string email)
108
{
11-
try
12-
{
13-
MailAddress m = new MailAddress(email);
14-
15-
return true;
16-
}
17-
catch (FormatException)
18-
{
19-
return false;
20-
}
9+
Regex regex =
10+
new Regex(
11+
@"^[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$");
12+
return regex.Match(email).Success;
2113
}
2214
}
2315
}

0 commit comments

Comments
 (0)