Java正则表达式匹配例子
1 package com.ibm.test; 2 3 import java.util.regex.Matcher; 4 import java.util.regex.Pattern; 5 6 public class Test { 7 public static void main(String[] args) { 8 String s=" 26301 56319.07 18324.02 "; 9 Pattern p = Pattern.compile("(\b\w+\.*\w*\b)"); 10 //匹配http://开头,不包含/的内容 11 Matcher match = p.matcher(s); 12 String domain = ""; 13 while (match.find()) { 14 domain = match.group(); 15 System.out.println(domain); 16 } 17 18 //LINESTRING(7.255032 43.701172) 19 } 20 }
}
}