Regular Expressions

A regular expression (regex) is a pattern for matching text, used to validate, extract, replace and split. It is a RegExp object, accepted by match(), matchAll(), replace(), search() and split() (String Prototype Methods). Write a literal such as /ab+c/i for a fixed pattern, or build one at run time with ` new RegExp(^${prefix}\\d+$, 'i') `, where every backslash is doubled because the string literal consumes one.

Anatomy of a regex literal and what exec() returns with the d flag
Anatomy of a regex literal and what exec() returns with the d flag

Subsections