为什么模式正则表达式[0-9a-z] {6}不替换?

时间:2019-02-01 06:06:42

标签: java regex

嗨,这段代码有什么问题?为什么不替换呢?

String text= new String("0x421256,0x4a1256,0x4a1256,0x4a1256");
System.out.println(text.replaceAll("0x(?=\\[0-9a-z]{6})|(0)x(?=\\[0-9a-z{5})","$1"));

输出应为421256,4a1256,4a1256,4a1256

但它是0x421256,0x4a1256,0x4a1256,0x4a1256

0 个答案:

没有答案