am looking for the regular expression of indian phone number
the regular expression should allow all the following formats.
for landline no
0802404408
080-2404408
+91802404408
+91-802404408
for mobile no
8147708287
08147708287
+918147708287
+91-8147708287
can anyone help me, thanks in advance
my code is
[RegexValidator("[0-9 -]*"
, MessageTemplateResourceName = "INVALID_PHONE"
, MessageTemplateResourceType = typeof(ValidatioinErrors))]
public string Phone
{
get { return phone; }
set { phone = value; }
}
public bool IsValid()
{
return Validation.Validate<Class_name>(this).IsValid;
}
public ValidationResults ValResults
{
get
{
return Validation.Validate<Class_name>(this);
}
}
for this validation thing I just referred
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
in my namespace, in the UI part the expression is working fine, but in the code behind as above, it shows "Invalid Phone number", if I give value as 080-2404408
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…