public class Main { public static void main(String[] argv) throws Exception { System.out.println(java.util.Arrays.toString( "abasdfasdf1 2wasdfasdf9_8asdfasdfz asdfasdfyx7". replaceAll("\\D", " ").replaceAll(" +", " ").split(" "))); } }