Source @ github

RegExp

RegExp – Creates a RegExp object.

Description

new RegExp(string pattern, [string flags])

Parameters

Name Description Type Default Optional
pattern string No
flags string Yes

Examples

Example #1 – RegExp example
var regexp = new RegExp('(?:)'); console.log(regexp); // /(?:)/ regexp = new RegExp('(?:)', 'ig'); console.log(regexp); // /(?:)/gi regexp = /([a-z])/m; console.log(regexp); // /([a-z])/m

External references