I have something like \"ali123hgj\". i want to have 123 in integer. how can i make it in java?
You could probably do it along these lines:
Pattern pattern = Pattern.compile("[^0-9]*([0-9]*)[^0-9]*");
Matcher matcher = pattern.matcher("ali123hgj");
boolean matchFound = matcher.find();
if (matchFound) {
System.out.println(Integer.parseInt(matcher.group(0)));
}
It's easily adaptable to multiple number group as well. The code is just for orientation: it hasn't been tested.