I have a log file that contains sent and received messages. I want to extract these message using a regular expression. This is an example of log file:
Message recieved:0908082349234 Session: ...
A message is sent: 12344384834
I wrote the following regex to extract the message:
String pattern = "((A message is sent: )|(Message received:))(.*)(( Session:)|$)";
And it doesn't work. I tried many different forms of it but none of them worked. I want to do this using a single regex. Right now I use one regex for sent and another one for received. But there should be a way to use a single regex for both of them!