}
}
}
输出: there
===== Using Group: =====
there
说明:Capturing Group的编号是从1开始的。组号为0的组表示整个串。
4.2. 替换
Matcher提供用于替换的方法。一种是简单进行查找替换,使用replaceAll()方法。第二种更加灵活的方式,在使用的时候可以结合Capturing Group。
public class Test {
public static void main(String[] args) {
Pattern p = Pattern.compile("\\S \\s");
String inputString = "hey there feller";
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



