Do you understand the difference between Multiline and Single-line GREP modes?
These words — single-line, multiline — both are similar in spelling, but its are written in English exactly: one word with a hyphen, the second one word. The first assumption of the presence of two modes — single-line and multiline — used or first or second. But the modes are not mutually exclusive. They mean two completely different things, and each of its is on or off. Single-line mode (?s) changes the meaning of the . dot metacharacter, while multiline mode (?m) changes the meaning of the ^ and $ anchors.
Full text is here: