Regular expression for Telephones with numbers only and C # DDD [duplicate]

0

I would like an help to create a regular expression in C # that validates number of phones with DDD but without points and dashes, only numbers. It would be in the format XX12345678 and XX 123456789.

    
asked by anonymous 24.10.2017 / 14:54

2 answers

1

Take a look at this link below that has a super explained answer about your question.

How to do a regular expression for phone cell phone?

    
24.10.2017 / 15:08
4

Without the real need to do DDD validation, 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]));
}
    
24.10.2017 / 15:03