public static String extractDigitsFromString(final String input){
  return input.replaceAll("\\D","");
}

public static String extractDigitsFromString ( final String input ) { return input . replaceAll ( "\\D" , "" ) ; }
removes all non - digit characters from a string .
