test(
  string    要搜索的字符串
)

返回:找到true、未找到false



示例:

var str = "abcdef"; var regexp = /cd/g; var bol = regexp.test(str); 结果:true