Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Fast way to remove all non-numerical chars from a string

From: Tom::Conlin::gmail::com at: 24-Sep-2007 22:57

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]