blob: d60afcfd994ca9a0426d67c5f8d4368958e703b9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
using System.Net.Mail;
using System.Text.RegularExpressions;
namespace IOL.Helpers
{
public static class Validators
{
private static readonly Regex _norwegianPhoneNumber = new(@"^(0047|\+47|47)?[2-9]\d{7}$");
public static bool IsValidEmailAddress(this string value) {
return MailAddress.TryCreate(value, out _);
}
public static bool IsValidNorwegianPhoneNumber(this string value) {
return _norwegianPhoneNumber.IsMatch(value);
}
}
}
|