Search code examples
regexemailreplacenotepad++

Regex To Exclude The First Word


Scenario

Recently I extracted emails from 430 different html webpages of organizations with regex but some organizations had multiple emails and here's what the mess looks like

Input

   Organization 2

     info@something.org.au more@something.com market@gmail.com single@noidea.com human@myplace.com south@north.com darlings@mall.com 


   Organization 3

  headmistress@money.com head@skull.com  

What I want
The very first email of these organizations is the important email. Is there any way regex can select everything after the first whole word and I can use Notepad++'s "Replace All" to remove it?

Output(Something like this)

   Organization 2

     info@something.org.au


   Organization 3

  headmistress@money.com

Solution

  • To get your expected output, use this pattern:

    /^.*?@[^ ]+|^.*$/gm
    

    Online Demo