正则表达式在一个字符串里面查找不相邻的两个数字解决思路
正则表达式在一个字符串里面查找不相邻的两个数字
比如有一个字符传 indiator[0].indicatorLelvel[0].Relationship
我要用正则表达式查找到这个字符串中的0;
大神 ..
查找第一个是var parrent = /\[\d\]/; 两个一起找怎么写啊
------解决方案--------------------
JS的话正则后面加g
比如有一个字符传 indiator[0].indicatorLelvel[0].Relationship
我要用正则表达式查找到这个字符串中的0;
大神 ..
查找第一个是var parrent = /\[\d\]/; 两个一起找怎么写啊
------解决方案--------------------
JS的话正则后面加g
- JScript code
var s = "indiator[0].indicatorLelvel[0].Relationship"; var parrent = /\[\d\]/g; var result = s.match(parrent); for(var i in result){ alert(result[i]); }