-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.cs
41 lines (33 loc) · 979 Bytes
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Text.RegularExpressions;
using System.Xml;
namespace Student
{
public class Utils
{
public static bool IsValidName(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
return false;
}
string pattern = "^[A-Z][a-zA-Z]*$";
return Regex.IsMatch(name, pattern);
}
public static bool IsValidPhone(string phone)
{
return Regex.IsMatch(phone, @"^\d{8,15}$");
}
public static bool IsValidEmail(string email)
{
return Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$");
}
public static bool isValidGrupe(string value)
{
return Regex.IsMatch(value, @"^[A-Za-z\d]{4,6}$");
}
public static bool isValidAdress(string adress)
{
return Regex.IsMatch(adress, "^[A-za-z\\d-. /]{10,100}$");
}
}
}