I have several strings in the rough form:
[some text] [some number] [some more text]
I want to extract the text in [some number] using the
Pattern p = Pattern.compile("(\\D+)(\\d+)(.*)"); Matcher m = p.matcher("this is your number:1234 thank you"); if (m.find()) { String someNumberStr = m.group(2); int someNumberInt = Integer.parseInt(someNumberStr); }