API-Version: 1.9

RegExp

new RegExp()

Standard RegExp object with additional methods

Source:

Methods

<static> escape(string) → {String}

Escapes special characters that are used in regular expressions

Parameters:
Name Type Description
string String

String to escape

Source:
Returns:

The escaped string

Type
String
Example
 
// /.*foo\.bar\[\].*$/
var r = new RegExp(".*" + RegExp.escape("foo.bar[]") + ".*$");