javaScript正则表达式

正则表达式的创建

1
2
3
4
5
// 方式一
let pattern = /test/;

// 方式二,
var pattern = new RegExp("test");