String str = "The party has been divided abs14 on! the issue, with moderates5789 concerned about the effects on the most vulnerable."; String[] words = str.split("\\s+"); System.out.println(Arrays.toString(words)); I break a line into an array of words on a space. And then it is necessary to somehow set the condition that if the word does not contain special characters and numbers, then it will be added to the variable count . Tell me how to do it correctly, without using regex. Need to create another array char ?