日期:2014-05-16 浏览次数:20391 次
regex.jsp:
<script> var pattern = "http://www.sina.com/jacky" var regex = /http:\/\/(w{3})\.(\w+)\.(\w+)\/(\w+)/g; /* * g--全局匹配模式 i--不区分大小写 */ var a = pattern.match(regex); document.write(a); </script>
?regex.java:
String buffer = "to_be_tested" Pattern p = null; Matcher m = null; p = Pattern.compile("[atcgnATCGN]+"); m = p.matcher(buffer); boolean b = m.matches();
?