Regex Matches exclude a word

Taken a random text:
My first mail-address is and my second mail-address is Just examples.

Now I’d like to match mail addresses but not “” with regex.
I have tried with negative look-behind but for me it only ignores the first letter of the word but not the whole word, which is what i need.

Would be very grateful for help.


Matches will give output as IEnumberable(list), if you want to get the second value then you write as List(1).ToString

Hope this may help you


is it about the position ( do not take first email) or is it about the value (do not take

on second case you can do

for regex use a pattern matching all emails

create a String array/list with blacklisted emails
arrBlockList = {“”}

Case: Matches acitvity - output: myMatches
arrFiltered = myMatches.Except(arrBlockList).toArray

Case: Regex.Matches - returned result variable myMatchCollection
arrFiltered =

myMatchCollection.Cast(Of Match).Select(Function (x) x.toString).Except(arrBlockList).toArray

hey @Tim_Gentemann
try with this one
Solution 1: ([a-zA-Z0-9_-.])+@([a-zA-Z0-9_-.])+.([a-zA-Z]{2,5})

Hey @Tim_Gentemann
try with this solution
(?<=address is)([a-zA-Z0-9_-.])+@([a-zA-Z0-9_-.])+.([a-zA-Z]{2,5})

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