RegExp object has the following properties:
Pattern | meaning |
---|---|
global | A Boolean value indicating whether the g flag has been set. |
ignoreCase | A Boolean value indicating whether the i flag has been set. |
lastIndex | An integer indicating the character position where the next match will be attempted in the source string. This value begins as 0. |
multiline | A Boolean value indicating whether the m flag has been set. |
source | The string source of the regular expression. |
Here's an example:
var pattern1 = /\[bc\]at/i; console.log(pattern1.global); //false console.log(pattern1.ignoreCase); //true console.log(pattern1.multiline); //false console.log(pattern1.lastIndex); //0 console.log(pattern1.source); //"\[bc\]at" var pattern2 = new RegExp("\\[bc\\]at", "i"); console.log(pattern2.global); //false console.log(pattern2.ignoreCase); //true console.log(pattern2.multiline); //false console.log(pattern2.lastIndex); //0 console.log(pattern2.source); //"\[bc\]at"