C#中美国电话号码的正则表达式? [英] Regular Expression For US Phone Number in C#?
问题描述
朋友您好, ^ [ 01]?[ - 。]?(\([2-9] \d {2} \)| [2-9] \d {2})[ - 。]?\d {3} [ - 。]?\d {4} $表达式。但它适用于10位数字验证。我可能有12位数字,如23-456-213-765。这是什么正则表达式? Hello friends, ^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$ expression . But it is fine for 10 digit numbers validation. I may have 12 digit numbers like 23-456-213-765 . What is the regular expression for this? 这篇关于C#中美国电话号码的正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
如果您知道美国电话验证的正则表达,请告知我们。我使用过
If you know regular expression for US phone validation please let me know. I have used
推荐答案
您可以编辑现有的或添加另一个验证号码。您看到的每个\d {3} \d {2}都指的是允许在 - 或者 - 之间插入的数字。所以你要做的就是增加这个数字,以便使用更多的数字。
You can edit the existing or add another one to validate the number. Each \d{3} \d{2} you see refers to the digits that are allowed to be inserted between the - or the . so all you have to do, is increase that number to allow more digits to be used.