How to split name from whole sentence

hi friends can someone help me split only the name from this sentence. my robot is currently pulling this name from mail subject, but i only want the name from the mail subject. for example mail subject is: SPEAR New Hire - Nicholas Ursini.
i want only the name, and the name will change always. but not the other parts

find two options with the assumption we can rely on hyphen and one line subject with told pattern:
grafik

YourSubjectVar.Split("-"c).Last().Trim
 System.Text.RegularExpressions.Regex.Match(YourSubjectVar, "(?<=\-).*$").Value.Trim()

Hello @Shazid_Rahman

You can do as below.

Split(“SPEAR New Hire - Nicholas Ursini”,“-”)(1).ToString.Trim()

Thanks

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