您的位置:首页 > 其它

关于字符串math函数的用法例子

2016-12-09 11:46 260 查看
var objStr=new String("Yue I love you till the end of my life!");
var reg3 = /[^\s+]/g;
objStr.match(reg3)
//结果:
["Y", "u", "e", "I", "l", "o", "v", "e", "y", "o", "u", "t", "i", "l", "l", "t", "h", "e", "e", "n", "d", "o", "f", "m", "y", "l", "i", "f", "e", "!"]

var reg = "hellow word";

reg.match(/\w+\o\w+/g)
//结果
["hellow", "word"]

//可以理解为match() 方法可在字符串内检索指定的值,或找到一个或多个正则表达式的匹配。


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: