JS Built-ins
RegExpmultilinebeginner

RegExp multiline β€” no m flag

πŸ“– 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 false when the 'm' flag is not set.

Challenge: Verify that /hi/.multiline equals false.

πŸ’‘ Hints (1)
  • β€’ Without the m flag, ^ and $ match only the start/end of the entire string