Can't match this list item's with REGEX

Hi, I have a list of strings; each include a name and email; some have just duplicate emails

(ListOfStrings) [Cat McCay - c.mccay@hotmailcom, christine@comuk - christine@comuk , Lisa Glen - glennon@yahoo]

BLOCK:RemoveAllFromList
LABEL:FINAL
list = @FINALOutput
comparison = MatchesRegex
term = “?”
ENDBLOCK

What regex to use in order to remove all duplicate emails? So all what’s left will be (name - email)
I tried ~30 different regex’s from the google to remove duplicate words/expressions, no1 worked.

BLOCK:ConstantList
  value = ["Cat McCay - c.mccay@hotmailcom", "Lisa Glen - glennon@yahoo", "christine@comuk", "christine@comuk"]
  => VAR @constantListOutput
ENDBLOCK

BLOCK:RemoveAllFromList
  list = @constantListOutput
  comparison = MatchesRegex
  term = "^[^@ \\t\\r\\n]+@[^@ \\t\\r\\n]+$"
ENDBLOCK

2 Likes

Thanks but it doesn’t work. After tried 100+ other possible combinations, I got it working, this :

(?<=\b| )([^ ]+)(?= |$).+(\1)

in some situations it might remove a few extra valid stuff but in my actual scenario, that is ok.

1 Like