Try this:
private void MyButton_Click(object sender, EventArgs e)
{
string inp = "< ch.syslogged > firmNb = 2 & documentNb = 36729 & type = invoiceDebtor & customerNb = 10";
string pat = ".*documentNb\\s*=\\s*(?<docNb>\\d+).*?customerNb\\s*=\\s*(?<custNb>\\d+)";
Match m = Regex.Match(inp, pat);
if (m.Success)
{
Console.WriteLine($"{m.Groups["docNb"]}:{m.Groups["custNb"]}");
}
}
If you are going to use regular expressions, you need a helper tool. Get a copy of
Expresso[
^] - it's free, and it examines and generates Regular expressions.