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
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 Yes |
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 Yes |
Legend
- Full support
- Full support