Sunday, December 29, 2024
Google search engine
HomeLanguagesJavascriptJavaScript RegExp dotAll Property

JavaScript RegExp dotAll Property

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.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments