5. JavaScript RegExp 类型
来源:互联网 发布:java谷歌地图开发 编辑:程序博客网 时间:2024/06/05 09:45
1. RegExp 类型
一般的分组()即括号中没有?:的使用时regexp对象都会将分组内匹配到的内容记录下来re = /(abc){2}/;//将匹配abcabc 这时RegExp会储存abcvar str = "abcabc";re.test(str);alert(RegExp.$1);加上?:后re = /(?:abc){2}/;RegExp 就不会储存这个分组了var str = "abcabc";re.test(str);alert(RegExp.$1);
RegExp 实例属性:
var pattern1 = new RegExp("bc","i"); alert(pattern1.global); alert(pattern1.ignoreCase);
RegExp 实例方法:
var text = "mom and dad and baby"; var pattern = new RegExp("mom(and dad(and baby)?)?","gi"); var matches = pattern.exec(text); alert(matches); alert(matches.index); alert(matches.input); alert(matches[0]); alert(matches[1]); alert(matches[2]);
0 0
- 5. JavaScript RegExp 类型
- Javascript的RegExp类型
- JavaScript学习-RegExp类型
- JavaScript之RegExp类型
- JavaScript中的RegExp类型
- 【JavaScript学习】RegExp类型
- javascript正则表达式(RegExp类型)
- 【JavaScript】RegExp 类型正则表达式
- JavaScript的RegExp类型总结
- JavaScript引用类型——RegExp
- 浅谈JavaScript引用类型——RegExp
- JavaScript的引用类型RegExp如何使用?
- RegExp类型
- RegExp类型
- RegExp类型
- Javascript --RegExp
- JavaScript RegExp
- JavaScript RegExp
- google支付简略流程
- 判断内表是否不为空的一般写法
- ubantu下部署scrapyd
- 把C++的类的方法直接作为线程的回调函数
- 理解Java之泛型
- 5. JavaScript RegExp 类型
- 【Axure学习】(一)Axure元素如何进行垂直等距分布?
- java web 登录后更新JSESSIONID
- Aptitude Test Practice
- 实现渐变色的JProgressBar
- 优秀博客1
- ios语法——委托和协议
- php clone()中的地址传递(&)
- 深入理解Java:SimpleDateFormat安全的时间格式化