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
Monica Priyadharshini
NA
103
5k
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();
}
}
Reply
Answers (
2
)
How do i reduce loop size using list or linq in C#
How do i find employee who are hired 6 weeks ago from curren