regex all but numbers code example Example: regex all not numbers echo 1a2b3c | sed 's/[^0-9]//g' #Replaces all not numbers abc