You can always do this if stryour line is:
var digits = str.replace(/\D/g, ""),
letters = str.replace(/[^a-z]/gi, "");
Essentially, this code does the replacement of all characters that you don't want with an empty string.
\D [^a-z] , , , -. g . i , .