ROWS: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Execution Time(sec.): 0.000006 Raw Match Pattern: \\[([^\\]]+)\\] Process: *(\\S+) \\|Organization: *(\\S+) \\|Thread: *(\\S+) \\|Category: *(\\S+) \\|User: *(\\S+) \\|Level: *(\\S+) \\|(.*?)((?<=\\r\\n)>.*?)?(?=\\[([^\\]]+)\\] Process:|$) C#.NET Code Example: using System; using System.Text.RegularExpressions; namespace myapp { class Class1 { static void Main(string[] args) { String sourcestring = "source string to match with pattern"; Regex re = new Regex(@"\\[([^\\]]+)\\] Process: *(\\S+) \\|Organization: *(\\S+) \\|Thread: *(\\S+) \\|Category: *(\\S+) \\|User: *(\\S+) \\|Level: *(\\S+) \\|(.*?)((?<=\\r\\n)>.*?)?(?=\\[([^\\]]+)\\] Process:|$)",RegexOptions.Singleline); MatchCollection mc = re.Matches(sourcestring); int mIdx=0; foreach (Match m in mc) { for (int gIdx = 0; gIdx < m.Groups.Count; gIdx++) { Console.WriteLine("[{0}][{1}] = {2}", mIdx, re.GetGroupNames()[gIdx], m.Groups[gIdx].Value); } mIdx++; } } } } Matches Found: NO MATCHES.
using System; using System.Text.RegularExpressions; namespace myapp { class Class1 { static void Main(string[] args) { String sourcestring = "source string to match with pattern"; Regex re = new Regex(@"\\[([^\\]]+)\\] Process: *(\\S+) \\|Organization: *(\\S+) \\|Thread: *(\\S+) \\|Category: *(\\S+) \\|User: *(\\S+) \\|Level: *(\\S+) \\|(.*?)((?<=\\r\\n)>.*?)?(?=\\[([^\\]]+)\\] Process:|$)",RegexOptions.Singleline); MatchCollection mc = re.Matches(sourcestring); int mIdx=0; foreach (Match m in mc) { for (int gIdx = 0; gIdx < m.Groups.Count; gIdx++) { Console.WriteLine("[{0}][{1}] = {2}", mIdx, re.GetGroupNames()[gIdx], m.Groups[gIdx].Value); } mIdx++; } } } }