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:

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