Let Me Help You Out, Comcast
Dec 1 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:

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

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

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

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

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