Andy said:
Don't ! Phone numbers don't need structure - you just dial them and
they work. Trying to impose a structure like this causes no end of
problems (I used to write commercial desktop apps - I learned this
_years_ ago).
Right. But *do* allow the user to type non-digits:
a. optional + at the start to symbolize your international access code
b. spaces between groups of digits
c. hyphens (dashes) between groups of digits
d. slashes...
e. parentheses...
f. periods...
g. etc
I believe the maximum length of a phone number is currently 18 digits
(max 4 for country code, max 6 for area code, max 8 for number) plus
up to 6 more for direct in-dial extensions, and whatever you consider
reasonable for punctuation (say 8), giving a total for your overall
length of 32.
Formatting is tempting, because at least 15% of respondents will get
their own phone number wrong, IMHE. But it's too complex to model in
a Schema: the ITU will supply you with the standard formats for each
country if you really want them, but you'll spend the next year making
them work as patterns.
///Peter