def parse_from_string(raw_string)
      # Optional +  1 -./ 256 (opt) 456 -./ 1234 ext(opt) 1234 (opt)
      phone_regexp = / \+? \s* 1? \s* [.\/-]? \s*
                       [\(]?([2-9][0-8]\d)?[\)]? \s* [.\/-]? \s*
                       ([2-9]\d{2}) \s* [.\/-]? \s*
                       (\d{4}) [\s|,|-]* 
                       \(? (?:\s*[ext|ex|x|xt|\#|:]+[^\d]*(\d+))? /xi
      match = phone_regexp.match(raw_string)
      if ! match.nil?
        # puts "Setting values #{match.captures.pretty_inspect}"
        @area_code = match.captures[0]
        @prefix = match.captures[1]
        @number = match.captures[2]
        @extension = match.captures[3]
      else
        # puts "No matchy :("
      end

      if ! default_area_code.nil? and ( @area_code.nil? or @area_code.empty? )
        @area_code = default_area_code
      end
    end
def parse_from_string(raw_string)
      # Optional +  1 -./ 256 (opt) 456 -./ 1234 ext(opt) 1234 (opt)
      phone_regexp = / \+? \s* 1? \s* [.\/-]? \s*
                       [\(]?([2-9][0-8]\d)?[\)]? \s* [.\/-]? \s*
                       ([2-9]\d{2}) \s* [.\/-]? \s*
                       (\d{4}) [\s|,|-]* 
                       \(? (?:\s*[ext|ex|x|xt|\#|:]+[^\d]*(\d+))? /xi
      match = phone_regexp.match(raw_string)
      if ! match.nil?
        # puts "Setting values #{match.captures.pretty_inspect}"
        @area_code = match.captures[0]
        @prefix = match.captures[1]
        @number = match.captures[2]
        @extension = match.captures[3]
      else
        # puts "No matchy :("
      end

      if ! default_area_code.nil? and ( @area_code.nil? or @area_code.empty? )
        @area_code = default_area_code
      end
    end
There are lots of regexp-for-phone-number dissussions, but I found this one most useful:
   http://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation
 Nice discussion here, and it had this one, which became the germ of mine.  I added optional
 parentheses around the area code, the /x and spacing for readability, and changed out \W for
 [.\/-] for the delimiters to tighten what I'd accept a little bit.

 The original was (in perl)
   my $us_phone_regex = '1?\s*\W\s*([2-9][0-8][0-9])\W*([2-9][0-9]{2})\W*([0-9]{4})(\se?x?t?(\d*))?';