In my opinion You get true
, because regex is focused on finding letters. It would say false
only, when You test string with no letters at all.
Please consider changing if else
statement and regex to find out if there are other symbols than letters:
Pattern pattern = Pattern.compile("[^\w]");
Matcher matcher = pattern.matcher("testTest");
if (matcher.find()){
tv.setText("false");
}
else{
tv.setText("true");
}
Hope it helps. Cheers.