检查JavaScript字符串是否包含与正则表达式匹配的子字符串。
我尝试过 string.includes(substring)。
我尝试过 string.includes(substring)。
var myString = "This is my test string: AA.12.B.12 with some other chars";
myString.includes(/^[A-Z]{2}\.\d{2}\.\[A-Z]{1}\.\d{2,3}$/);
真,假
然而,代码无法编译
.test()
。 - Pointy