正则函数匹配字符串2019-06-03

var words ="hello word hello word hello word";

//一.console.log(words.match(/hello\s+word/g));

//二.

function pipei(words){

                     //匹配

return words.match(/hello\s+word/);

}

console.log(pipei(words));

你可能感兴趣的:(正则函数匹配字符串2019-06-03)