RegExp Instance Properties

Each instance of RegExp has the following properties:

PropertyMeaningType
globalwhether the g flag has been set.Boolean
ignoreCasewhether the i flag has been set.Boolean
lastIndexthe character position where the next match. This value begins as 0.integer
multilinewhether the m flag has been set.Boolean
sourcethe 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>
  
Click to view the demo
Home 
  JavaScript Book 
    Essential Types  

REGEXP:
  1. The Regexp Type
  2. RegExp constructor
  3. RegExp Instance Properties
  4. RegExp's exec() does the matching.
  5. RegExp's test()
  6. RegExp's toLocaleString() and toString()
  7. RegExp Constructor Properties