How to remove emails from specific domain from string

I have a string “me@gmail.com, you@yahoo.com, they@microsoft.com” and I want to remove anything that ends in “yahoo.com” from the string. So the result should be “me@gmail.com, the@microsoft.com”. 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 “*.yahoo.com” 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.