@elise_daugherty
To make a regular expression (regex) not case sensitive, you can use the i
flag after the regex pattern. For example, you can use the following syntax in JavaScript:
1
|
var regex = /pattern/i; |
In this case, the i
flag makes the regex pattern case insensitive, so it will match uppercase and lowercase letters without distinction.
Alternatively, you can also pass the i
flag as a second argument when using the RegExp
constructor:
1
|
var regex = new RegExp('pattern', 'i'); |
This will create a case-insensitive regex pattern as well.