1
I would like a help to create a regular expression in C# that validates number of phones with DDD but no dots and dashes, only numbers. Would be in XX12345678 and XX 123456789 format.
1
I would like a help to create a regular expression in C# that validates number of phones with DDD but no dots and dashes, only numbers. Would be in XX12345678 and XX 123456789 format.
4
No real need to validate DDD, only digits remain :
\d{10,11}
var list = [
'5112345678',
'61123456789',
'1112345678',
'21123456789',
];
for(var i in list){
console.log(list[i], /\d{10,11}/.test(list[i]));
}
Has calls where still use 7 digits for phone, in some interior lost.
@Jeffersonquesado just do the calculation 7 digits (min) + 2 DDD = 9 then starts at 9 and the other 9 digits (max) +2 DDD = 11, so the range is {9,11}
1
Take a look at this link below that has a super explained answer about this question.
Reading the answer worked, I only removed the trace and parentheses for my validation. Ficou desta forma: ^[1-9]{2}(?:[2-8]|9[1-9])[0-9]{3}[0-9]{4}$ Obrigada!
Browser other questions tagged c# regex
You are not signed in. Login or sign up in order to post.
How about:
.. ......(.(.(.)?)?)?
Space only to facilitate reading, not real. And in place of.
you can put[0-9]
– Jefferson Quesado