(?m)applies the following effective flags to the remainder of the pattern: gm m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string
^start of line
Negative Lookahead(?!.*Failed to connect) .*any character (except for line terminators), repeated any number of times
Failed to connectthe literal text Failed to connect (case sensitive) .+any character (except for line terminators), repeated at least once
\Ra newline sequence
.*any character (except for line terminators), repeated any number of times
Exceptionthe literal text Exception (case sensitive) .*any character (except for line terminators), repeated any number of times
\Ra newline sequence
g modifier: global. Finds all matches instead of stopping after the first