JavaScript | multiline Property
The multiline Property property in Javascript is used to specify whether the “m” modifier is set or not. If the “m” modifier is set than this property returns true else false.
Syntax:
RegexObj.multiline
Return Value: It returns true if m modifier is set, else false.
Example-1: This example checks if the regular expression contains m Modifier or not.
<!DOCTYPE html> <html> <head> <title> multiline Property </title> </head> <body style="text-align:center"> <h1 style="color:green"> GeeksforGeeks </h1> <h2>multiline Property</h2> <button onclick="geek()"> Click it! </button> <script> function geek() { var regex = new RegExp('foo', 'm'); alert(regex.multiline); } </script> </body> </html> |
Output:
Before Click:

After Click:

Example-2: This example checks if the regular expression contains m Modifier or not.
<!DOCTYPE html> <html> <head> <title> multiline Property </title> </head> <body style="text-align:center"> <h1 style="color:green"> GeeksforGeeks </h1> <h2> multiline Property </h2> <button onclick="geek()"> Click it! </button> <script> function geek() { var regex = /[a-d]/; var str = "GeeksforGeeks\n"+ "is the computer\n"+ "science portal for geeks."; if (regex.multiline) { alert("m Modifier is present"); } else { alert("m Modifier is absent."); } } </script> </body> </html> |
Output:
Before Click:

After Click:

Supported Browsers: The browsers supported by multiline Property are listed below:
- Google Chrome
- Apple Safari
- Mozilla Firefox
- Opera
- Internet Explorer
Recommended Posts:
- Displaying inline and multiline blocks of code using Bootstrap
- JavaScript | Math.LN2 property
- JavaScript | global Property
- JavaScript | Math.PI Property
- Javascript | MouseEvent which Property
- JavaScript | source Property
- JavaScript | Error name Property
- How to remove CSS property using JavaScript?
- JavaScript | undefined Property
- JavaScript | Cursor property
- JavaScript | lastIndex Property
- JavaScript | Infinity Property
- JavaScript | Number constructor Property
- JavaScript | String constructor Property
- JavaScript | MouseEvent Button Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



