regex - Extract numbers from a string in java -


i want extract numbers string like:

str="good_mor9ni13ng_23guys "; 

the output should array [9,13,23]. how should proceed?

you this:

list<string> matches = new arraylist<string>(); matcher m = pattern.compile("[0-9]+").matcher("good_mor9ni13ng_23guys"); while (m.find()) {     matches.add(m.group()); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -