I have this code:
String s = "bla mo& lol!";
Pattern p = Pattern.compile("[a-z]");
String[] allWords = p.split(s);
I'm trying to get all the words according to this specific pattern into an array. But I get all the opposite.
I want my array to be:
allWords = {bla, mo, lol}
but I get:
allWords = { ,& ,!}
Is there any fast solution or do I have to use the matcher and a while loop to insert it into an array?