0

example :

hello this my email [email protected] contact me
yes this my email [email protected]:contactmenow
user:3:[email protected]:contactme
hello this is my email andre,[email protected],
hello ... this is my email [email protected]

I need result like this (delete all not specific email address character and extract it) using regex (emdeditor):

[email protected]
[email protected]
[email protected]
[email protected]

so email [email protected] deleted help please.
thankyou.

3
  • Why [email protected] must be deleted? What are the rules?
    – Toto
    Commented Mar 30, 2020 at 14:18
  • What this have to do with outlook?
    – Toto
    Commented Mar 30, 2020 at 14:20
  • because I no want extract <pre>[email protected]</pre>
    – Benjamin
    Commented Mar 30, 2020 at 14:27

1 Answer 1

0

Here is a way to do the job with Notepad++:

  • Ctrl+H
  • Find what: ^.*?(?:user5@other\.com|([^\s,:]+@[^\s:,]+)).*?$
  • Replace with: (?1$1:)
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

^                           # beginning of line
  .*?                       # 0 or more any character but newline, not greedy
  (?:                       # non capture group
      user5@other\.com      # literally
    |                     # OR
      (                     # group 1
        [^\s,:]+            # 1 or more any character that is not space, comma or colon
        @                   # @
        [^\s,:]+            # 1 or more any character that is not space, comma or colon
      )                     # end group 1
  )                         # end group
  .*?                       # 0 or more any character but newline, not greedy
$                           # end of line

Replacement:

(?1         # if group 1 exists
  $1        # take it
  :         # else, nothing
)           # endif

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

3
  • how to I extract spesific email domain?
    – Benjamin
    Commented Mar 30, 2020 at 15:47
  • if I use (?: # non capture group it's waste time because too much email need for delete
    – Benjamin
    Commented Mar 30, 2020 at 15:49
  • @Benjamin: which specific domain? Why is it waste time? Sorry, I don't get you, what do you want exactly? Edit your question with real test cases with expected result.
    – Toto
    Commented Mar 30, 2020 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .