public class MyClass {
static String extract_only_numbers(String s) {
int len = s.length();
String regx = "[0-9]";
String numbers = "";
for (int i = 0; i < len; i++) {
char ch = s.charAt(i);
if (String.valueOf(ch).matches(regx))
numbers = numbers + ch;
}
return numbers;
}
public static void main(String args[]) {
String s = "c++14$vb.net&%java*() php <>/python 3.7.3";
System.out.println(extract_only_numbers(s));
}
}
/*
run:
14373
*/