I am very new in regex topic. I want to parse log files with following regex:
(?
Let me "convert" my comment into an answer since now I see what you can do about the regex performance.
As I have mentioned above, replace all .*? with [^|]*, and also all repeating [|][|][|] with [|]{3} (or similar, depending on the number of [|]. Also, do not use nested capturing groups, that also influences performance!
var logFileFormat = @"(?
Only the last .* can remain "wildcardish" since it will grab the rest of the line.
Here is a comparison of your and my regex patterns at RegexHero.
Then, use RegexOptions.Compiled:
Regex pattern = new Regex(LogFormat.GetLineRegex(logFileFormat), RegexOptions.Compiled);