How to get first text before comma in uipath or regex?

Text = Mithesh Reddy, Hello
I need to get Reddy as my output from above text.

example
Text = hello how r u raj, where are u from?
expected result = raj

1 Like

Hi @MitheshBolla

System.Text.RegularExpressions.Regex.Match(Input,"[A-Za-z]+(?=\s*\,)").Value 

Regards

Hi @MitheshBolla

Output:-
image

Regex:-
System.Text.RegularExpressions.Regex.Match(inputText, “\b\w+(?=,)”).Value

Xaml File:-
Main.xaml (7.2 KB)

If this works for you, please mark it as a solution, so others can refer the same. :slight_smile:

Thanks

1 Like

Hi @MitheshBolla

You can try the below syntax too

InputVar.Split(",").First.ToString.Split(" ").Last

Regards

1 Like

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