D
D
Dmitry2016-09-13 08:28:52
Java
Dmitry, 2016-09-13 08:28:52

Why doesn't regular expression work in Java?

Hello, I have this code:

String[] out_arr = out.split(" ");
for(int z=0; z < out_arr.length; z++){
if(out_arr[z].matches("[a-z]+")) {
System.out.println(out_arr[z]);
}

In out_arr in the debugger, you can see an array with something like this: "[" , "+", "342", "slovo1", "slovo", "*", "%"... etc. Those. there are values ​​in the array elements that fall under this regular expression, but it does not work. Why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question