JS Built-ins
RegExpmultilinebeginner

RegExp multiline β€” m flag set

πŸ“– Usage Example
const re = /^start/m
console.log(re.multiline) // β†’ true
// ^ and $ match at line boundaries

Read RegExp.multiline to check whether the 'm' flag is set on the regular expression.

RegExp.prototype.multiline

The multiline property is true when the 'm' flag is set.

Challenge: Verify that /hi/m.multiline equals true.

πŸ’‘ Hints (1)
  • β€’ The m flag makes ^ and $ match start/end of each line, not just the whole string