19. The RegExp Object
Join the Discussion
More of this Feature
Introduction Pattern Matching Ignore Case and Global Replacing Matches Spliting Matches Start and End Meta Characters Character Classes Repetitions Greedy, Reluctant, etc. Predefined Classes Special Characters ASCII and Unicode Boundaries Grouping Back References Non-Capturing Groups Lookahead Multiline Mode
var re = /\bthe\b/ig;
var re2 = new RegExp('\\bthe\\b','ig');
A RegExp object once defined can be used in exactly the same way whichever of the two methods are used to define it.