import java.util.*;
import java.util.regex.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
String example
= "my attachements with some name (56).jpg"; Matcher m = Pattern.compile("(?<=\\()\\d+(?=\\)\\.)").matcher(example);
example
= m.
replaceAll(r
-> String.
valueOf(Integer.
parseInt(m.
group())+1) ); System.
out.
println( example
); }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4Lio7CmltcG9ydCBqYXZhLmxhbmcuKjsKaW1wb3J0IGphdmEuaW8uKjsKCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQkgU3RyaW5nIGV4YW1wbGUgPSAibXkgYXR0YWNoZW1lbnRzIHdpdGggc29tZSBuYW1lICg1NikuanBnIjsKCQkgTWF0Y2hlciBtID0gUGF0dGVybi5jb21waWxlKCIoPzw9XFwoKVxcZCsoPz1cXClcXC4pIikubWF0Y2hlcihleGFtcGxlKTsKCQkgZXhhbXBsZSA9IG0ucmVwbGFjZUFsbChyIC0+IFN0cmluZy52YWx1ZU9mKEludGVnZXIucGFyc2VJbnQobS5ncm91cCgpKSsxKSApOwoJCSBTeXN0ZW0ub3V0LnByaW50bG4oIGV4YW1wbGUgKTsKCX0KfQ==