"I get a curved line under (\s)*
and a message:
Error 1 Unrecognized escape sequence"
The reason is simple:
"(exitCode)+(\s)*:(\s)*(?<exitCode>[^;]+)(\s)*;(\s)*(session id is)(\s)*(?<sessionID>[^;]*)(\s)*"
The '\' character is being interpretted as a C# string escape, and it is trying to tell you that it doesn't know the escape sequence '\s'. To fix, either replace the '\' characters with '\\', or put an '@' character before the opening double quote:
@"(exitCode)+(\s)*:(\s)*(?<exitCode>[^;]+)(\s)*;(\s)*(session id is)(\s)*(?<sessionID>[^;]*)(\s)*"
For your actual regex, try this:
public static Regex regex = new Regex(
It is well worth getting a copy of Expresso
] It's free and it really helps work out regexes!