On https://www.emacswiki.org/emacs/MultilineRegexp one finds the hint to use
[\0-\377[:nonascii:]]*\n
instead of the standard
.*\n
to match any character up to a newline to avoid stack overflow for huge texts (37 KB). Is the overflow the concern here, or is a matching run for the former also more performant than the latter?