📜  比较字符串驼峰和小写 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:09.944000             🧑  作者: Mango

代码示例5
var haystack = "A. BAIL. Of. Hay.";
var needle = "bail.";
var needleRegExp = new RegExp(needle.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i");
var result = needleRegExp.test(haystack);
if (result) {
    // Your code here
}