Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle lines which do not match regex #67

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/RegexColumnizer/RegexColumnizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLin
if (Regex != null)
{
var m = Regex.Match(line.FullLine);
for (int i = m.Groups.Count - 1; i > 0; i--)

if (m.Success)
{
logLine.ColumnValues[i-1] = new Column
for (int i = m.Groups.Count - 1; i > 0; i--)
{
logLine.ColumnValues[i-1] = new Column
{
Parent = logLine,
FullValue = m.Groups[i].Value
};
}
}
else
{
logLine.ColumnValues[columns.Length - 1] = new Column
{
Parent = logLine,
FullValue = m.Groups[i].Value
FullValue = line.FullLine
};
}
}
Expand Down Expand Up @@ -148,4 +160,4 @@ public class Regex6Columnizer : Regex1Columnizer { }
public class Regex7Columnizer : Regex1Columnizer { }
public class Regex8Columnizer : Regex1Columnizer { }
public class Regex9Columnizer : Regex1Columnizer { }
}
}