pattern to just ignore and not ignore case replace in javascript code example
Example 1: compare string camelcase and lowercase javascript
str.toUpperCase() === str || str.toLowerCase() === str;
Example 2: compare string camelcase and lowercase javascript
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
}