获取括号中匹配到的第几组数据。例如
//mongodb://username:password@hostname:port/dbname String patternStr="mongodb://(.*),(.*):(.*)/(.*)" Pattern pattern = Pattern.compile(patternStr); pattern.matcher("mongodb://username:password@hostname:port/dbname") m.find(); String user = m.group(1); String ip= m.group(2); String port= m.group(3); String dbName= m.group(4);
标签:group,String,mongodb,Pattern,Patten,方法,port,patternStr From: https://www.cnblogs.com/zhangshiwen/p/16938912.html