JS Built-ins
RegExpbeginner

RegExp Constructor β€” case insensitive flag

πŸ“– Usage Example
const re1 = /hello/i
const re2 = new RegExp('hello', 'i')
re1.test('Hello world') // β†’ true

Use the RegExp constructor or literal syntax to create a regular expression.

RegExp Constructor β€” Flags

The i flag makes the RegExp case insensitive.

Challenge: Verify that /hello/i.test('HELLO') returns true.

πŸ’‘ Hints (1)
  • β€’ Add the i flag after the closing slash: /pattern/i