Kai Peters wrote:
...
> For now, all phone numbers hail from
> North America - so valid lengths are 
> 
> a) 7 digits    - local number
> b) 10 digits  - area code included
> c) 11 digits  - leading 1 in front of area code

a slightly more rigid grammar to catch bogus numbers

digit: charset "0123456789"
octit: charset "23456789"
qudit: charset "0123"
sep: ["-"|"."|"_"|"/"] ;;; whatever
exchange: [octit 2 digit]
subscriber: [4 digit]
;;; 7 digit
phone-number: [exchange opt sep subscriber]
;;; 10 digit
area-code: [opt "(" octit qudit digit opt ")" phone-number]
;;; 11 digit
long-distance: [ "1" opt sep area-code]

rule: [ long-distance | area-code | phone-number]
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to