String.match(正则 或 'string') 有两种方式

method1:

'1aaa2bb3'.match(/\d/g) //return : [1,2,3]

method2:

'1aaa2bb3 hello world'.match('world ') //return null,是因为后面有个空格所以返回null

'1aaa2bb3 hello world'.match('world') //return world

posted @ 2017-11-11 11:14  tangchangcai  阅读(5079)  评论(0编辑  收藏  举报