码迷,mamicode.com
首页 > 其他好文 > 详细

match方法

时间:2019-12-19 16:21:32      阅读:391      评论:0      收藏:0      [点我收藏+]

标签:regex   输出   ons   console   exp   数字   个数   reg   返回   

<script>
/*
获取其中的数字字符,并以数组的形式输出
如果match没有找到任何匹配的文本, match() 将返回 null。否则,它将返回一个数组
*/
var str = "fhdghdf6587fgjfe65556gty4y54y8yt";
var regExp = /\d+/g;
console.log(str.match(regExp));
</script>

match方法

标签:regex   输出   ons   console   exp   数字   个数   reg   返回   

原文地址:https://www.cnblogs.com/zhangyue690811/p/12068154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!