4 ms·
Why just stop at dashes and spaces? s/\D//g
by cliveholloway 17y ago
Why just stop at dashes and spaces?
s/\D//g
- jerf 17y agoThank 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.)