Simple java regex not matching -


my regex returning false, cant understand why.

pattern patt = pattern.compile("\\d+"); patt.matcher("a 18c1").matches(); //returning false 

also tried [0-9]+ , (\\d+), ([0-9]+), didnt work too.. can me? thanks

this because use .matches(). want .find().

.matches() misnomer; try , match against entire input. regex matching done using .find():

final matcher matcher = patt.matcher("a 18c1"); if (matcher.find())     system.out.println(matcher.group()); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -