Regex

1. regex with variable

example: find the number and put a parenthese around the number.

output: 

a(5265)b

String field = "a5265b";
String result = field.replaceAll("(\d+)", "($1)");
原文地址:https://www.cnblogs.com/phoenix13suns/p/5489329.html