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
Post a Comment