Hi,
I am new to the regex concept I used it in several occasions and it was extremely helpful for my purpose. Now I need to extract data from very large log file 30 000 lines and up and than take this information line by line and store it to a data set.
I have the part where I read the file line by line, but I am not sure how to construct my regex search patter in order to get the info. I am using c# and here is my input file. Thanks in advance.
Input file:
07.07.2008 00:00:00.168 | guardserv.exe/PROD | 2924 | INFO | 00000000 | Reading License Files in D:\tt\datfiles\.
07.07.2008 00:00:00.183 | guardserv.exe/PROD | 2924 | INFO | 00000000 | Using License Files in D:\tt\datfiles\ with Update Count: 486
07.07.2008 00:37:21.692 | guardserv.exe/PROD | 2924 | INFO | 00000000 | License will expire. Exch:XXXX App:TT_XTRD_PRO-SUBSCR Expiry:15.07.2008
07.07.2008 00:37:21.692 | guardserv.exe/PROD | 2924 | INFO | 00000000 | License will expire. Exch:XXXX App:TT_XTRD_PRO-SUBSCR Expiry:15.07.2008
07.07.2008 00:37:28.443 | guardian.exe/PROD | 3436 | INFO | 00000000 | Universal login for user N1MSPRINGER successful
07.07.2008 00:37:28.489 | priceproxy.exe/PROD | 2400 | INFO | 00000000 | LoginUser for user TTORDMJMJYN1MSPRINGER addr xxx.xxx.x.xxx accepted.
07.07.2008 00:37:28.489 | guardian.exe/PROD | 3436 | INFO | 00000000 | Universal login request for user N1MSPRINGER started
07.07.2008 00:37:28.583 | guardian.exe/PROD | 3436 | INFO | 00000000 | Universal login for user N1MSPRINGER successful
I only need the line which is bolded. Technically my app reads the file line by line in a loop and when I find the line I am looking for (bolded) I need to parse the following information:
1. 07.07.2008 00:37:28.489 2. guardserv.exe/PROD 3. TTORDMJMJYN1MSPRINGER 4. xxx.xxx.x.xxx
I would really appreciate if someone can get me started with the Regex search pattern.
Here is how I loop through the lines in c#:
foreach (Match m in rC.Matches(val))
{
}
Regex rc;