TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Psymon
NA
18
7.1k
Regex Incorrect parameters
Nov 30 2011 12:23 PM
Hi All
Thanks in advance for any assistance. I understand there are a multitude of regex questions and answers out there but i can seem to nail this one....
I am attempting to parse log file data, everything appeared to be working ok until comparing the result sets with the original logs.
I have the following log structure:
07/11 22:49:36:808: Item_Process_Start
07/11 22:49:36:808: LogData
...LogData
...LogData
...LogData
...LogData
07/11 22:49:46:990: Item_Process_End_Success
07/11 22:49:36:808: Item_Process_Start
07/11 22:49:36:808: LogData
...LogData
...LogData
...LogData
...LogData
07/11 22:49:46:990: Item_Process_End_Failed
07/11 22:49:36:808: LogData
...LogData
...LogData
...LogData
...LogData
07/11 22:49:46:990: Item_Process_End_Success
I am trying to capture log data for items between Item_Process_Start and Item_Process_End_Success i do not want to include the failed items data as it is for generating a report of successful items only.
My regex (quite bloated) is as follows:
(?<day>\d{1,2}:)/(?<month>\d{1,2}:)[\s](?<hour>\d{1,2}:)(?<minute>\d{1,2}:)(?<seconds>\d{1,2}:)(?<ms>\d{3}:)\sItem_Process_Start(?s:.*?.*)(?<day>\d{1,2}:)/(?<month>\d{1,2}:)[\s](?<hour>\d{1,2}:)(?<minute>\d{1,2}:)(?<seconds>\d{1,2}:)(?<ms>\d{3}:)\sItem_Process_End_Success
It seems this is a rather greedy search and will also capture failed all items?
Any help on how i can capture the successful items only would be great.
Many thanks
Reply
Answers (
2
)
Use of abstract class
Programmatically find out the latest modified file in a folder