Dart RegExp isDotAll
Syntax & Examples


RegExp.isDotAll property

The `isDotAll` property in Dart's `RegExp` class determines whether the '.' character in the regular expression matches line terminators.


Syntax of RegExp.isDotAll

The syntax of RegExp.isDotAll property is:

 bool isDotAll 

This isDotAll property of RegExp whether "." in this regular expression matches line terminators.

Return Type

RegExp.isDotAll returns value of type bool.



✐ Examples

1 Using Dot All mode

In this example,

  1. We create a `RegExp` object named `pattern` with the pattern '.' and dotAll set to true.
  2. We print the value of `isDotAll` property, which should be true indicating that '.' matches line terminators.

Dart Program

void main() {
  RegExp pattern = RegExp('.', dotAll: true);
  print(pattern.isDotAll);
}

Output

true

2 Not using Dot All mode

In this example,

  1. We create a `RegExp` object named `pattern` with the pattern '.' and dotAll set to false.
  2. We print the value of `isDotAll` property, which should be false indicating that '.' does not match line terminators.

Dart Program

void main() {
  RegExp pattern = RegExp('.', dotAll: false);
  print(pattern.isDotAll);
}

Output

false

Summary

In this Dart tutorial, we learned about isDotAll property of RegExp: the syntax and few working examples with output and detailed explanation for each example.