Andreas Korthaus: Unterschied RegEx Flag "m" zu "s"

Beitrag lesen

Hi!

The "/s" and "/m" modifiers both override the $* setting. That is,
        no matter what $* contains, "/s" without "/m" will force "^" to
        match only at the beginning of the string and "$" to match only at
        the end (or just before a newline at the end) of the string.
        Together, as /ms, they let the "." match any character whatsoever,
        while still allowing "^" and "$" to match, respectively, just after
        and just before newlines within the string.

Danke Euch!

Verstehe ich das jetzt richtig dass der Unterschid zu keinem flag und /m darin besteht das ^ und $ nicht nur auf String-Anfang bzw. -Ende treffen, sondern von bzw. nach jedem newline?

/s im gegensatz zu ohne flag triff t mit . auch newline-Zeichen, und in Kombination treffen /ms treffen . auf alle Zeichen(auch newline) aber ^ und $ funktionieren trotzdem wie bei /m alleine. Ist das so richtig?

Grüße
Andreas