Regular Expressions

Ismael123

Member
Joined
May 13, 2016
Messages
14
Programming Experience
1-3
Hi, I wrote a regex to check a phone number format in my view-model but it always raises an error no matter how the number looks like.
I want it to be in either of these 2 formats
05XXXXXXXXX
02XXXXXXXXX

C#:
        [DataType(DataType.PhoneNumber)]
        [RegularExpression(@"/^(0)[5|2]\d{9}\$/g", ErrorMessage = "Telefon numarayi 0xxxxxxxxxx formatinda girin")]
        public string Telefon { get; set; }
 
Back
Top Bottom