News for hackers. Stuff that matters.
Re:"No Dashes Or Spaces" Hall of Shame by cliveholloway on Friday March 19, 2010 @02:30AM (#1203528)
Why just stop at dashes and spaces?

s/\D//g

Re:"No Dashes Or Spaces" Hall of Shame by jerf on Friday March 19, 2010 @02:21PM (#1204837)
Thank you, beat me to posting it.

Never "filter out the badness", always "filter for only the goodness" then use the good value. Exhaustively enumerating the goodness is easier than exhaustively enumerating the badness.

(I'd combine this with a check for length, too.)