There's no difference between phone and fax numbers. To make a regular expression, you'd have to ask yourself a couple of questions:
- Do you require an area code, or will 7 digits be acceptable? Do you want to validate the area code as well?
- In the US, it's not uncommon to use letters instead of digits. Is your regexp going to allow that?
- Do you insist on separators? Are the optional? Forbidden? If they are separators, can they be dashes? Spaces? Either, but not mixed? Allowed elsewhere than the standard 3-3-4 grouping? Can you have parenthesis around the area code?
- Do you require a leading 1? Is it optional? Do you allow the international '+' prefix?
- What about extensions? Allowed? If so, for how many numbers?
- It's possible to hook in a fax into a 911 dispatch center, making it a 'fax number' as well. Are you going to allow that as well?
Depending on the answers, your regexp can be as simple as
/1[0-9]{10}/, or something far more complex.
1-800-JAVA-FAN