I have a string with a number inside and I want to retrieve that number. for example if I have a string "bla bla 45 bla bla" I want to get the number 45. I have searched a bit and found out that this code should make the work
Matcher matcher = Pattern.compile("\d+").matcher("bla bla 45 bla bla");
if(matcher.matches())
String result = matcher.group();
but it doesn't :(
probably the problem is that "d+" regular expression is converted to "^d+$" and so the matcher doesn't matches the number inside the text.
Any ideas.