using System.Text.RegularExpressions;
public static void Main()
string message = "Already Zalary.Core.Absence that matches 15-07-2024 00:00:00 or 15-07-2024 00:00:00 Line: 156, uid: 100a0e53-94d5-4fa4-aef0-63b97f9ff262.";
string pattern = @"Line(.*)(?:uid|EmployeeId|EmployeeUid|UserId|UserUid)(.*)";
Match match = Regex.Match(message, pattern, RegexOptions.IgnoreCase);
string stringAfterLine = match.Groups[1].Value.Trim();
string stringAfterUid = match.Groups[2].Value.Trim();
var firstOccuranceOfInt = Regex.Match(stringAfterLine, @"\d+").Value;
var isLineNumberParsed = int.TryParse(firstOccuranceOfInt, out int lineNumber);
int LineNumber = isLineNumberParsed && lineNumber != 0 ? lineNumber : 0;
var firstOccuranceOfGuid = Regex.Match(stringAfterUid, "[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}").Value;
var isGuidParsed = Guid.TryParse(firstOccuranceOfGuid, out Guid employeeId);
Guid UUID = isGuidParsed && employeeId != Guid.Empty ? employeeId : Guid.Empty;
Console.WriteLine("Resulting string " + LineNumber);
Console.WriteLine("Resulting string " + UUID);