one of the documented procedures in this installation of the ACS
util_parse_phone   phone_number
What it does:
Tries to figure out the phone number from a user-entered string. Returns a tcl list with phone number and maybe extension.
Defined in: /web/philip/tcl/intranet-wap-defs.tcl

Source code:

    set result [ns_set new]

    # Ugh.  We should have stricter data format in the db.
    regsub -all {\)|\(|\-|\.} $phone_number { } phone

    if [regexp {([0-9][0-9][0-9]) +([0-9][0-9][0-9]) +([0-9][0-9][0-9][0-9])} $phone match area_code prefix suffix] {
	# looks like a US phone number
	regexp -indices {[0-9][0-9][0-9] +[0-9][0-9][0-9] +[0-9][0-9][0-9][0-9]} $phone ind
	if { [lindex $ind 0] <= 1 } {
	    # looks a lot like a US phone number.
	    set last_part [string range $phone [expr [lindex $ind 1] + 1]  [string length $phone]]
	    ns_set put $result number [list "$area_code$prefix$suffix"]
	    ns_set put $result type UsTenDigit
	    if [regexp {([xX]|ext|ex) *([0-9][0-9][0-9])} $last_part match ext_str ext] {
		    ns_set put $result extension $ext
	    return $result
    # Just return all digits if we get here.
    regsub -all {[^0-9]} $phone_number {} all_the_digits
    ns_set put $result number $all_the_digits
    return $result