NerdyC

Welcome to the OCD nerd power hour.

RSS

Photo Dec 01, 2008

A huge usability pet peeve of mine is when sites ask you to enter account numbers without dashes or spaces. This one is from Comcast’s online account registration, but I’ve seen them in plenty of places. It’s practically a standard to tell you not to enter anything except the raw numbers.

Account numbers often have dashes/spaces in them precisely because it makes them easier to read and verify. In fact, the bill which I was told to copy the account number from had spaces in it. Other numbers, like a US Social Security Number have an internal structure that also can tell you things like which state a number was generated in.

There is no technical reason except laziness to forbid people to enter dashes. Your code already works for numbers without dashes, right? Let me help you out:

Ruby:account_number.gsub(/\D+/, '')

PHP:preg_replace("/\\D+/", "", $account_number)

Java:accountNumber.replaceAll("\\D+", "")

Python:re.sub(r'\D+', '', account_number)

Now you have no excuse, so STOP IT. It’s getting annoying.

A huge usability pet peeve of mine is when sites ask you to enter account numbers without dashes or spaces. This one is from Comcast’s online account registration, but I’ve seen them in plenty of places. It’s practically a standard to tell you not to enter anything except the raw numbers.

Account numbers often have dashes/spaces in them precisely because it makes them easier to read and verify. In fact, the bill which I was told to copy the account number from had spaces in it. Other numbers, like a US Social Security Number have an internal structure that also can tell you things like which state a number was generated in.

There is no technical reason except laziness to forbid people to enter dashes. Your code already works for numbers without dashes, right? Let me help you out:

Ruby:
account_number.gsub(/\D+/, '')

PHP:
preg_replace("/\\D+/", "", $account_number)

Java:
accountNumber.replaceAll("\\D+", "")

Python:
re.sub(r'\D+', '', account_number)

Now you have no excuse, so STOP IT. It’s getting annoying.

About the Author

Portrait photo for NerdyC

A {food, computer, language} nerd who lived in NYC for 9 years, but is now much happier in SFO.

Stuff I Like

Following:

parislemon kkr theworldwelivein photojojo ohscience timoni superamit kthread dphiffer darrellsilver nattles jkottke americandrink annielin americanmccarver dianakimball colinmeloy abangupjob john mizginevra thoughtbot html5watch chiragdave leyink jessaclark rdeeming ericsuesz visivo netflixmoviesthatdontsuck fuckyeahamitgupta lazycrafter bikebasketpies kimjoar grubbin internetlovesamit jeanniechoe clairebrain enjoywhatyoudrink materialco youaremybestfriend venturecraftrepost philco bhaggs imnotdeadyet seaweedbutter marycrosse lovealgorithm topicalpickuplines tehawesodotme recombobulation whatwouldjoando