Help extracting text from a regular expression
I am new to regular expression i am trying to write a regular expression so that i can extract text from a line .This is one of the sample line "2007-01-10 16:42:06,646 DEBUG 2216 Symcon.Utils.MessageLogger.Logger - WRITE ERROR IN Range Name: __INPUT.Sample_MasterItem1.R37.I.S2.M1.81918e77_d7 32_48da_8634_849d2eb2fa27"
I have written a regular expression for this as
"(?<DateTime>((?:\d{4}|\d{2}))-(\d{1,2})-(\d{1,2})\s(\d{1,2}):(\d{1,2}):(\d{1,2})),(?<code> \d{3})\s(?<type>[A-Z]{5})\s(?<errornum>\d{4})\s(?<LogName>^[a-zA-Z.]+$)(?<ErrorMsg>[A-Za-z:\b])(?<RangeName>[a-zA-Z\d\.__])"
the text retrieved from the groups are as follows
<DateTime> = "2007-01-10 16:42:06"
<code> ="646"
<type> = "DEBUG"
<errornum>="2216"
<LogName>="S"
<ErrorMsg>="y"
<RangeName>="m"
I want the <LogName> to have the complete string "Symcon.Utils.MessageLogger.Logger" instead of "S" and <ErrorMsg> = WRITE ERROR IN Range Name: and <RangeName> = __INPUT.Sample_MasterItem1.R37.I.S2.M1.81918e77_d7 32_48da_8634_849d2eb2fa27
I have been trying to solve this for quite some time :( .Can any one please help me with this issue
Thanks in advance
Manju
|