Regex split function,

Jul 25 2019 8:19 AM
I would like get the string in the formate of
<BR/>2016-04-08 06:04:21 - elango - Comtag Added- Assigned to- sivaraman(E)- Email Notification Sent To karthik.47(E)- This is sample comtag for<BR/> esclation tsting
<BR/>2016-04-08 06:08:37-sivaraman- Responded- Response Type:Executive Email Notification Sent To karthik.47(E)- This is for testing the edit loan
<br/>2016-04-08 06:22:24-Vinoth-Transferred To- sivaraman(E)- Response Type:Escalation Email Notification Sent To karthik.47(E)- Transfer to Siva
and store it in array using a Regex pattren, but i am getting the out put as,
""
<BR/>2016-04-08 06:04:21
<BR/>2016-04-08 06:04:21
<BR/>
- elango - Comtag Added- Assigned to- sivaraman(E)- Email Notification Sent To karthik.47(E)- This is sample comtag for<BR/> esclation tsting
<BR/>2016-04-08 06:08:37
<BR/>2016-04-08 06:08:37
<BR/>
-sivaraman- Responded- Response Type:Executive Email Notification Sent To karthik.47(E)- This is for testing the edit loan
<br/>2016-04-08 06:22:24
<br/>2016-04-08 06:22:24
<br/>
-Vinoth-Transferred To- sivaraman(E)- Response Type:Escalation Email Notification Sent To karthik.47(E)- Transfer to Siva
 
My code,
 
class Program
{
static void Main(string[] args)
{
string comment;
comment = "2016-04-08 06:04:21 - elango - Comtag Added- Assigned to- sivaraman(E)- Email Notification Sent To karthik.47(E)- This is sample comtag for<BR/> esclation tsting<BR/>2016-04-08 06:08:37-sivaraman- Responded- Response Type:Executive Email Notification Sent To karthik.47(E)- This is for testing the edit loan<br/>2016-04-08 06:22:24-Vinoth-Transferred To- sivaraman(E)- Response Type:Escalation Email Notification Sent To karthik.47(E)- Transfer to Siva";
comment = "<BR/>" + comment;
string pattern = @"((((<BR/\s>|<br/\s>)|(<BR/>|<br/>))\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})[a-zA-Z\s.,0-9@#$%*():;""'/?!+=_-]*)";
string[] substrings = Regex.Split(comment, pattern, RegexOptions.Multiline);
foreach (var a in substrings)
{
Console.WriteLine(a);
}
Console.ReadLine();
}
}

Answers (2)