正则表达式
RegExp 类型
test()
var a = /cat/g.test('catalog');
console.log(a) // true
var a = new RegExp('cat', 'g');
var b = a.test('catalog');
console.log(b); // true
exec()
var text = 'mom and dad and bady';
var pattern = /.om/g;
var matches = pattern.exec(text);
console.log(matches[0]); // mom
浙公网安备 33010602011771号