现在的位置: 首页 > 综合 > 正文

正则表达式

2017年12月27日 ⁄ 综合 ⁄ 共 1175字 ⁄ 字号 评论关闭

---推荐链接:
正则表达式30分钟入门教程: https://deerchao.net/tutorials/regex/regex.htm 
正则表达式语法:http://www.cnblogs.com/yasin/archive/2009/07/20/1527013.html 

http://dragon.cnblogs.com/archive/2006/05/08/394078.html 

js-w3c正则表达式: http://www.w3school.com.cn/js/jsref_obj_regexp.asp 
js正则表达式:http://www.cnblogs.com/rubylouvre/archive/2010/03/09/1681222.html 
java正则表达式:

http://www.cnblogs.com/lonelysharer/archive/2012/03/08/2384773.html 

http://www.cnblogs.com/Lowp/archive/2012/09/22/2698574.html 

http://josh-persistence.iteye.com/blog/1881270 

http://zhuobinzhou.iteye.com/blog/805141 

http://developer.51cto.com/art/200906/131761.htm 

http://www.cnblogs.com/ggjucheng/p/3423731.html 

---js正则表达式:
方式1:
<script type="text/javascript">
var str = "Visit W3School";
var patt1 = new RegExp("W3School");
var result = patt1.test(str);//test()方法用于检测字符串是否匹配某个模式.
document.write("Result: " + result);
</script>
方式2:
console.log(/[0-9]/.test("8"));//true

---java正则表达式:
方式1:
Pattern p=Pattern.compile("\\d+"); 
Matcher m=p.matcher("22bb23"); 
m.matches();//返回false,因为bb不能被\d+匹配,导致整个字符串匹配未成功. 
Matcher m2=p.matcher("2223"); 
m2.matches();//返回true,因为\d+匹配到了整个字符串 
方式2:
Pattern.matches("\\d+","2223");//返回true 

---正则表达式深入:
//分组group
//反向
//断言
//贪婪
//...

具体待研究(代码)

抱歉!评论已关闭.