正则表达式30分钟入门教程
http://deerchao.net/tutorials/regex/regex.htm
javascript 正则表达式-司徒正美
http://www.cnblogs.com/rubylouvre/archive/2010/03/09/1681222.html
Java正则表达式详解
http://edu.yesky.com/edupxpt/18/2143018.shtml
常用的正则表达式
http://www.aslibra.com/doc/regex.htm
应用代码:
http://deerchao.net/tutorials/regex/regex.htm
javascript 正则表达式-司徒正美
http://www.cnblogs.com/rubylouvre/archive/2010/03/09/1681222.html
Java正则表达式详解
http://edu.yesky.com/edupxpt/18/2143018.shtml
常用的正则表达式
http://www.aslibra.com/doc/regex.htm
应用代码:
java.util.regex.Pattern p2 = java.util.regex.Pattern.compile("([a-zA-Z]+[1-4]{0,1})=");
java.util.regex.Matcher m = p2.matcher(query);
StringBuffer sb = new StringBuffer();
while(m.find()){ m.appendReplacement(sb,m.group(1).toUpperCase()+"=");
}
m.appendTail(sb);
query_input = sb.toString();
public static void main(String[] args) {
Pattern p = Pattern.compile("(TS:\\(\\S*\\))");
Matcher m = p.matcher("(TS:(1) OR PC:(ab))");
StringBuffer sb = new StringBuffer();
while (m.find()) {
m.appendReplacement(sb, "TI:(1) OR AB:(1)");
}
m.appendTail(sb);
System.out.println(sb.toString());
}