I need to classify each line as "announce, whisper or chat" once I have that sorted out I need to extract certain values to be processed.
Right now my regex is as follow:
var regex = new Regex(@"^\[(\d{2}:\d{2}:\d{2})\]\s*(?:(\[System Message\])?\s*<([^>]*)>|((.+) Whisper You :))\s*(.*)$");
- Group 0 is the entire message.
- Group 1 is the hour time of when the message was sent.
- Group 2 is wether it was an announce or chat.
- Group 3 is who sent the announce.
- Group 4 is if it was a whisper or not.
- Group 5 is who sent the whisper.
- Group 6 is the sent message by the user or system.
Classify each line:
if 4 matches
means it is a whisper
else if 2 matches
means it is an announce
else
normal chat
Should I change anything to my regex to make it more precise/accurate on the matches ?
Sample data:
[02:33:03] John Whisper You : Heya
[02:33:03] John Whisper You : How is it going
[02:33:12] <John> [02:33:16] [System Message] bla bla
[02:33:39] <John> heya
[02:33:40] <John> hello :S
[02:33:57] <John> hi
[02:33:57] [System Message] <John> has left the room
[02:33:57] [System Message] <John> has entered the room