转自:http://www.jb51.cc/article/p-zgusecne-se.html
点的转义:. ==> //u002E 美元符号的转义:$ ==> //u0024 乘方符号的转义:^ ==> //u005E 左大括号的转义:{ ==> //u007B 左方括号的转义:[ ==> //u005B 左圆括号的转义:( ==> //u0028 竖线的转义:| ==> //u007C 右圆括号的转义:) ==> //u0029 星号的转义:* ==> //u002A 加号的转义:+ ==> //u002B 问号的转义:? ==> //u003F 反斜杠的转义:/ ==> //u005C java使用简单匹配的两个类 cardno=";22222222?"; String PatternStr=";//d{8}//u003F";//问号转义 Pattern pattern = Pattern.compile(PatternStr); Matcher matcher = pattern.matcher(cardno); boolean result = matcher.matches(); result返回true
原文链接:https://www.f2er.com/regex/360735.html