|
@@ -183,7 +183,7 @@ public class StringUtils {
|
|
|
public static List<String> extractMessageByRegular(String msg){
|
|
|
|
|
|
List<String> list=new ArrayList<String>();
|
|
|
- Pattern p = Pattern.compile("(\\{[^\\}]*\\])");
|
|
|
+ Pattern p = Pattern.compile("\\{([^}]*)\\}");
|
|
|
Matcher m = p.matcher(msg);
|
|
|
while(m.find()){
|
|
|
list.add(m.group().substring(1, m.group().length()-1));
|
|
@@ -192,7 +192,7 @@ public class StringUtils {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String msg = "PerformanceManager[第1个中括号]Product[第2个中括号]<[第3个中括号]79~";
|
|
|
+ String msg = "PerformanceManager{第1个中括号}Product{第2个中括号}<{第3个中括号}79~";
|
|
|
List<String> list = extractMessageByRegular(msg);
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
System.out.println(i+"-->"+list.get(i));
|