15 chars · 3 lines
8 chars · 1 line
15 chars · 3 lines
8 chars · 1 line
Regex multiline behavior
Without m, ^ERROR$ applies to the boundaries of the complete input, so it does not find ERROR in the middle line of a multiline string. Add the JavaScript m flag when anchors should also recognize line boundaries. This tool is free to use. No account or payment is required.
Last updated
Multiline mode changes how ^ and $ behave. It does not make . match newlines; that behavior belongs to the s flag.
Keep ^ERROR$ and enable multiline mode.
^ERROR$ / no flagsmCommon questions
Without m, the anchors refer to the complete input boundaries rather than every line boundary.
No. Use s for dotAll behavior.
Yes, if you need both multiline anchors and case-insensitive matching.
Debugging a specific Regex issue? Browse Regex troubleshooting.