Web/JavaScript/Reference/Global objects/RegExp/multiline
The multiline property indicates whether or not the "m" flag is used with the regular expression. multiline is a read-only property of an individual regular expression instance.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Property attributes of RegExp.prototype.multiline
|
|
|---|---|
| Writable | no |
| Enumerable | no |
| Configurable | yes |
Description
The value of multiline is a Boolean and is true if the "m" flag was used; otherwise, false. The "m" flag indicates that a multiline input string should be treated as multiple lines. For example, if "m" is used, "^" and "$" change from matching at only the start or end of the entire string to the start or end of any line within the string.
You cannot change this property directly.
Examples
Using multiline
var regex = new RegExp('foo', 'm');
console.log(regex.multiline); // true
Specifications
| Specification |
|---|
| ECMAScript (ECMA-262)The definition of 'RegExp.prototype.multiline' in that specification. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
multiline
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 5.5 |
Opera
Full support 5 |
Safari
Full support 1 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
nodejs
Full support 0.1.100 |
| Prototype accessor property (ES2015) | Chrome
Full support 48 |
Edge
Full support 12 |
Firefox
Full support 38 |
IE
Full support 5.5 |
Opera
Full support 35 |
Safari
Full support 1.3 |
WebView Android
Full support 48 |
Chrome Android
Full support 48 |
Firefox Android
Full support 38 |
Opera Android
Full support 35 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 5.0 |
nodejs
Full support 6.0.0 |
Legend
- Full support
- Full support
See also
RegExp.lastIndexRegExp.prototype.globalRegExp.prototype.ignoreCaseRegExp.prototype.sourceRegExp.prototype.sticky
RegExp.prototype.multiline by Mozilla Contributors is licensed under CC-BY-SA 2.5.