How to remove emails from specific domain from string

I have a string “,,” and I want to remove anything that ends in “” from the string. So the result should be “,”. I’ve tried the replace method but it doesn’t look like I can use wildcards in the match string. Is there a way to remove the “*” email from the string?

Hello @rleonen , Welcome to the forums.

Please look up Regex Match and replace. You can use a regular expression to find all matches in a string and then replace them with blanks or remove them.

Here is a typical expression based on your Example:

A slight modification will help filter out more than one domain in the list:

I had posted a similar response on how to use Regex.Match in this post where we had to separate bullets from a bulleted text string.

I hope this helps.

1 Like

Hey @rleonen

Welcome to the UiPath Community Forums :partying_face:

Are you using UiPath Studio? If so, see below.

To use a regex.replace use an Assign Activity like this:
Str_Variable = System.Text.RegularExpressions.Regex.Replace(INSERT_INPUT_STRING, “INSERT_REGEXPATTERN”, “REPLACE_WITH_THIS”)
To replace with nothing use two quotes ("") in the last element.

If you are using Studio then I have made a workflow for your review but slightly different to what you have asked.

I have done something a bit different than what you have asked. I have used a regex pattern to match everything but the domains you want to keep “” and “” and then replace it with nothing. You can preview the Regex pattern here.

Check out the workflow I have made. Below is the Output pane.
Main.xaml (5.5 KB)


Hopefully all this helps you :blush: