2021-03-30 22:54
看看是否满足你的需求,() 表示不同的分组,group0 表示全匹配结果,group1表示第一个括号匹配出来的内容,gruop2、group3 同理
public static void main(String[] args) {
String htmlStr = "<Button ALIGN=LEFT ICON=\"NORMAL\" action=\"bypass -h Quest ArenaManager CPrecovery\">CP Recovery: 1,000 Adena</Button>";
String regEx_html = "(<.*?>)(.*?)(<.*?>)";
//定义HTML标签的正则表达式
Pattern p = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(htmlStr);
while (m.find()){
System.out.println(m.group(0));
System.out.println(m.group(1));
System.out.println(m.group(2));
System.out.println(m.group(3));
}
}
输出结果如下:
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ArenaManager CPrecovery">CP Recovery: 1,000 Adena</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ArenaManager CPrecovery">
CP Recovery: 1,000 Adena
</Button>
2020-01-06 13:59
@JFinal 好的,感谢波总,学到了~
#define updateColums(cols)
#for(x : cols)
#(for.first ? "" : ",") #(x.key) = '#(x.value)'
#end
#end
#sql("update_detail")
UPDATE T_SAL_ORDERENTRY SET #@updateColums(updateCols)WHERE FENTRYID = #(entryId)
#end