Non-Capturing Group(?:.*\n)? ?repeats the group contents below at most once:
.*any character (except for line terminators), repeated any number of times
\na line-feed (newline) character (ASCII 10)
.*any character (except for line terminators), repeated any number of times
\n?optionally matches a line-feed (newline) character (ASCII 10)
$end of string, or before its final line terminator