I came across the RegExp() object when I was looking at the code for a page search.
var searchTermRegex = new RegExp(tokens.join('|'), 'gim');
I was trying to work out what the 'gim' was all about and they turn out to be Search Modifiers
g - global, i - case insensitive, m - muti-line.
What MDN say:
Regular expressions are patterns used to match character combinations in strings.
These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods of String.
What W3C say:
A regular expression is a sequence of characters that forms a search pattern.
The search pattern can be used for text search and text replace operations.
The RegExp() Object
The W3C demo.
Click the button to return the function that created the RegExp object's prototype.