January 2020
Intermediate to advanced
548 pages
13h 36m
English
The literal syntax of regular expressions allows for specific flags, such as i (ignore-case), to be specified after the final delimiting forward slash. These flags will affect the way the regular expression is executed:
/hello/.test('hELlO'); // => false/hello/i.test('hELlO'); // => true
When using the RegExp constructor, you can pass your flags as the second argument:
RegExp('hello').test('hELlO'); // => falseRegExp('hello', 'i').test('hELlO'); // => true
There are six available flags in JavaScript's flavor of regular expression:
Read now
Unlock full access