, , .
, ?
, .
( # ), Regex IgnorePatternWhitespace, . , # .
string pattern = @"
^
(?:\(?)
(?<AreaCode>\d{3})
(?:[\).\s]?)
(?<Prefix>\d{3})
(?:[-\.\s]?)
(?<Suffix>\d{4})
(?!\d)
10 , ( -, , .. :
(555)555-5555 (OK)
5555555555 (ok)
555 555 5555(ok)
555.555.5555 (ok)
55555555556 (not ok - match failure - too many digits)
123.456.789 (failure)
IgnorePatternWhitespace:
^(?:\(?)(?<AreaCode>\d{3})(?:[\).\s]?)(?<Prefix>\d{3})(?:[-\.\s]?)(?<Suffix>\d{4})(?!\d)
, Named Captures
^(?:\(?)(\d{3})(?:[\).\s]?)(\d{3})(?:[-\.\s]?)(\d{4})(?!\d)
, ExplicitCapture
^\(?(?<AreaCode>\d{3})[\).\s]?(?<Prefix>\d{3})[-\.\s](?<Suffix>\d{4})(?!\d)