Search email in email viewer with condition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Manx
    Junior Member
    • Dec 2024
    • 2

    #1

    Search email in email viewer with condition

    Hi

    From email view I want to search for emails that DO NOT MATCH an email account or domain, for example, I want to search for all emails that do not belong to or do not contain @midominio.com .
    How can I do this? What should I type in the search field?.

    Is it necessary to use RegEx?

    Thanks.​
  • Richard (PassMark)
    Administrator
    • May 2010
    • 967

    #2
    You will need to use Regular Expression to accomplish the query.

    Possibly try

    Code:
    (?!.*@midominio\.com)(\w[\w\.]*@\w+\.[\w\.]+)\b
    See demo here.

    Comment

    • Manx
      Junior Member
      • Dec 2024
      • 2

      #3
      Thank you Richard,

      I have tested the code and it works ok.

      If I wanted to combine the search for several different domains, how would I do it? For example, if it DOES NOT CONTAIN @mydomain1.com NOR @mydomain2.com ?.

      Thank you very much.​

      Comment

      • David (PassMark)
        Administrator
        • Jan 2003
        • 11092

        #4
        Maybe something like this
        Code:
        (?!.*@(midominio\.com|anotherdomain\.com))(\w[\w\.]*@\w+\.[\w\.]+)\b
        Note that there are various regex builders online that can help.
        AI LLMs (like ChatGPT) can also help build up regex.


        Comment

        Working...