regex select everything that is not a number code example Example: regex all not numbers echo 1a2b3c | sed 's/[^0-9]//g' #Replaces all not numbers abc