I'm trying to read a log file and extract some machine/setting information using regular expressions. Here is a sample from the log:
...
COMPUTER INFO:
Computer Name: TESTCMP02
Windows User Name: testUser99
Time Since Last Reboot: 405 Minutes
Processor: (2 processors) Intel(R) Xeon(R) CPU 5160 @ 3.00GHz
OS Version: 5.1 .number 2600:Service Pack 2
Memory: RAM: 48% used, 3069.6 MB total, 1567.3 MB free
ServerTimeOffSet: -146 Seconds
Use Local Time for Log: True
INITIAL SETTINGS:
Command Line: /SKIPUPDATES
Remote Online: True
INI File: c:\demoapp\system\DEMOAPP.INI
DatabaseName: testdb
SQL Server: 10.254.58.1
SQL UserName: SQLUser
ODBC Source: TestODBC
Dynamic ODBC (not defined): True
...
I would like to capture each 'block' of data, using the header as one group, and the data as a second (i.e. "COMPUTER INFO", "Computer Name:.......") and repeat this for each block. The expression if have so far is
(?s)(\p{Lu}{1,} \p{Lu}{1,}:\r\n)(.*\r\n\r\n)
This pulls out the block into the groups like it should, which is great. But I need to have it repeat the capture, which I can't seem to get. I've tried several grouping expressions, including:
(?s)(?:(\p{Lu}{1,} \p{Lu}{1,}:\r\n)(.*\r\n\r\n))*
which would seem to be correct, but I get back lots of NULL result groups with empty group item values. I'm using the .Net RegEx class to apply the expressions, can anyone help me out here?