Java正则表达式匹配例子
package com.ibm.test; import java.util.regex.Matcher;
import java.util.regex.Pattern; public class Test {
public static void main(String[] args) {
String s=" 26301 56319.07 18324.02 ";
Pattern p = Pattern.compile("(\\b\\w+\\.*\\w*\\b)");
//匹配http://开头,不包含/的内容
Matcher match = p.matcher(s);
String domain = "";
while (match.find()) {
domain = match.group();
System.out.println(domain);
} //LINESTRING(7.255032 43.701172)
}
}
}
}