捡分:如何在字符串里拿出如15.0.1这样的字符串(字符串见内,最好是正则表达式)?
Adaptive Server Enterprise/15.0.1/EBF 14106 ESD#1 N-OFF/P/NT (IX86)/Windows 2000/ase1501ip/2395/32-bit/OPT/Mon Nov 13 20:22:38 2006Sybase
------解决方案--------------------java 应该是 (\\\d+\\\.+)+\\\d+ 在js里面是(\d+\.+)+\d+
不知道对不对? 规律为数字加. 最后是一个数字
------解决方案--------------------String s= "Adaptive Server Enterprise/15.0.1/EBF 14106 ESD#1 N-OFF/P/NT (IX86)/Windows 2000/ase1501ip/2395/32-bit/OPT/Mon Nov 13 20:22:38 2006Sybase ";
Pattern p = Pattern.compile( "(\\d+\\.){2}\\d+ ");
Matcher m = p.matcher(s);
while(m.find()){
System.out.println(m.group());
}
------解决方案--------------------Pattern pattern=Pattern.compile( "\\d{2}\\.\\d\\.\\d ");