How to extract every string in between different Delimeters

I have a string like this “;;” and I want to extract mich_Tom_Chaterd from this string.

This string contains 3 emails but there are strings that contains 1,2 or more than 3 emails.I want a generic solution

have a look here:

String.Join("_",(Regex.Matches(strText,"(\.|\w)*?(?=\@)").Cast(Of Match).Select(Function (x) x.toString.Split("."c)(0))))

Ensure following:

Challenging it with missing dots:

Its Working
Can you please explain this?

Str_Mails = “;;
Str_Test = Str_Test + Split(Mail.Trim,".")(0) + “_”
Str_Test = Str_Test.Substring(0,Str_Test.Length-1)

Regex -

With regex we do take all strings before the @ character
From all matches we do a split on the dot and take the first item
With String.Join we do surround the items with a “_”

1 Like

Thanks Alot
It really helped

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.