// The RegExp i Modifier in JavaScript is used to perform case-insensitive matching in the string.
/regexp/i
// OR
new RegExp("regexp", "i")
// example
const regex = /dannyglade/gi // /gi is modifiers
const str1 = 'DannyGlade' // will match
const str2 = 'dannyglade' // will also match
const str3 = 'DaNNyGlaDe' // will also match
const match = regex.test(str1)
const match = str2.match(regex) // alternate way to test regex
const string = 'Hello hello hello';
// performing a replacement
const result1 = string.replace(/hello/, 'world');
console.log(result1); // Hello world hello
// performing global replacement
const result2 = string.replace(/hello/g, 'world');
console.log(result2); // Hello world world
// performing case-insensitive replacement
const result3 = string.replace(/hello/i, 'world');
console.log(result3); // world hello hello
// performing global case-insensitive replacement
const result4 = string.replace(/hello/gi, 'world');
console.log(result4); // world world world