I need to increase each number String in two times. For example "32abcd54ab2abcd5" should be "64abcd108ab4abcd10". Is there any way to do this using regex, but not writing special function?
import java.util.regex.*;
class Test
{
public static void main(String[] args)
{
String s= "2aaa3bbb4";
Pattern p1 = Pattern.compile("(\\d+)");
Matcher m1 = p1.matcher(s);
String newString = m1.replaceAll(Integer.parseInt("$1") * 2 + "");
}
}