Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js regex i modifier

// 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
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #js #regex #modifier
ADD COMMENT
Topic
Name
2+4 =