Open In App

JavaScript RegExp dotAll Property

Improve
Improve
Like Article
Like
Save
Share
Report

JavaScript RegExp dotAll property is used to check whether the ‘s’ flag is set or not. If the ‘s’ flag is set then this property returns true else false.

Syntax:

Regexobj.dotAll

Return Value: A boolean value.

Example 1: This example checks if the regular expression contains s Modifier or not. 

Javascript




function dotAll_prop() {
    let regex = new RegExp(/[a-d]/, 's');
     
    console.log(regex.dotAll)
}
 
dotAll_prop();


Output

true

Example 2: This example checks if the regular expression contains s Modifier or not. 

Javascript




function dotAll_prop() {
    let regex = new RegExp(/[a-d]/);
 
    if (regex.ignoreCase) {
        console.log("i Modifier is present");
    } else {
        console.log("i Modifier is absent");
    }
}
 
dotAll_prop();


Output

i Modifier is absent

Supported Browsers:

  • Chrome 62
  • Edge 79
  • Firefox 78
  • Opera 49
  • Safari 11.1

We have a complete list of JavaScript RegExp expressions, to check those please go through this JavaScript RegExp Reference article.


Last Updated : 01 Aug, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads