public class Main {
public static void main(String[] args) {
String myStr = "任务完成!获得 30 金币和 500 经验值。";
String regex = "[0-9]+";
System.out.println(myStr.replaceFirst(regex, "($0)"));
}