RegExp Instance Properties
Each instance of RegExp has the following properties:
Property | Meaning | Type |
---|---|---|
global | whether the g flag has been set. | Boolean |
ignoreCase | whether the i flag has been set. | Boolean |
lastIndex | the character position where the next match. This value begins as 0. | integer |
multiline | whether the m flag has been set. | Boolean |
source | the regular expression. | string |
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var pattern1 = /\[oo\]at/i;
document.writeln(pattern1.global); //false
document.writeln(pattern1.ignoreCase); //true
document.writeln(pattern1.multiline); //false
document.writeln(pattern1.lastIndex); //0
document.writeln(pattern1.source); //"\[oo\]at"
var pattern2 = new RegExp("\\[oo\\]at", "i");
document.writeln(pattern2.global); //false
document.writeln(pattern2.ignoreCase); //true
document.writeln(pattern2.multiline); //false
document.writeln(pattern2.lastIndex); //0
document.writeln(pattern2.source); //"\[oo\]at"
</script>
</head>
<body>
</body>
</html>