I have a log file with these contents:
Log Started
Created Date: YY/MM/DD Time: HH:MM:SS Start
Added resources at module on YY/MM/DD HH:MM
Module 2 excecute
Resource depleted at HH:MM n pieces
Open YY/MM/DD HH:MM:SS Log to refer
Target end date of new resource YY/MM/DD approved
Log Ended. Result OK
Legend:
- 'YY/MM/DD' & 'HH:MM:SS' - these are the unimportant timestamps
- Everything else - there are the important data
Notes:
- As you can see, the date and time can both be in the same line, located anywhere within the line, and the time can be HH:MM or HH:MM:SS.
- Some lines can have no date/time stamps at all
I currently have the regex below, but it can only capture the date and time stamps on each line:
(\d{2}(\d{2})?\/\d{2}\/\d{2}(\d{2})?)|(\d{2}:\d{2}(:\d{2})?)
But, I need to be able to capture the whole line, and place each important and unimportant sections of data in a group.