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))))
Challenging it with missing dots:
Can you please explain this?
Str_Mails = “email@example.com; Tom.Szski@abc.com; Chaterd.Andrs@abc.com”
Str_Test = Str_Test + Split(Mail.Trim,".")(0) + “_”
Str_Test = Str_Test.Substring(0,Str_Test.Length-1)
Regex - Regex101.com
With regex we do take all strings before the
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 “_”
It really helped
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.