Link to home
Start Free TrialLog in
Avatar of whorsfall
whorsfallFlag for Australia

asked on

C# Regular Expression help.

Hi,

I am trying to get my regular expression in C# to extract the following

<![LOG[==========[ ccmsetup started in process 3172 ]==========]LOG]!><time="14:32:31.717-600"{ date="07-29-2013" component="ccmsetup" context="" type="1" thread="908" file="ccmsetup.cpp:9100">


so it would gather the following:

Capture 1: ==========[ ccmsetup started in process 3172 ]==========
Capture 2: 14:32:31.717-600
Capture 3: 07-29-2013

The problem happens if I have a multi-line entry:

<![LOG[Running installation package
  Package:     C:\Windows\ccmsetup\MicrosoftPolicyPlatformSetup.msi
  Log:         C:\Windows\ccmsetup\Logs\MicrosoftPolicyPlatformSetup.msi.log
  Properties:  REBOOT=Suppress ALLUSERS=1]LOG]!><time="14:33:26.552-600" date="07-29-2013" component="ccmsetup" context="" type="1" thread="908" file="msiutil.cpp:791">


I have got the following regular expression which almost works - except the new line.


<!\[LOG\[(.*)]LOG]!><time="(\d{1,2}:\d{1,2}:\d{1,2}.\d{1,3}-\d{1,3})"\sdate="(\d{1,2}-\d{1,2}-\d{1,4})"


Any suggestions on how to change the expression to make it work.


Thanks,

Ward.
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial