In C #, I want to use a regex to combine the same lines and add counters at the end of the line
this is my log text:
"000-00-0000" invalid ssn (1)
"111-******" invalid ssn (1)
"000-00-0000" invalid ssn (2)
"55/22/2009" invalid date (1)
"55/22/2009" invalid date (1)
"55/22/2009" invalid date (3)
I want to replace this
"000-00-0000" invalid ssn (3)
"111-******" invalid ssn (1)
"55/22/2009" invalid date (5)
I need a regex pattern to count matches and get each one and sum them up
I use the following code before each line added to the log
string error;
if (log_errors.Contains(error))
{
string pat = @"\b(" + error_string + " ([0-9]))" + @"\b";
Match match = Regex.Match(log_errors, pat , RegexOptions.IgnoreCase);
if (match.Success)
{
}
}
Thanks for any help
source
share