Extract all email addresses from bulk text using jquery

前端 未结 7 1502
北海茫月
北海茫月 2020-11-28 06:09

I\'m having the this text below:

sdabhikagathara@rediffmail.com, \"assdsdf\" , \"rodnsdfald ferdfnson\" 

        
相关标签:
7条回答
  • 2020-11-28 06:59

    You can use this regex:

    var re = /(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g;
    

    You can extract the e-mails like this:

    ('sdabhikagathara@rediffmail.com, "assdsdf" <dsfassdfhsdfarkal@gmail.com>, "rodnsdfald ferdfnson" <rfernsdfson@gmail.com>, "Affdmdol Gondfgale" <gyfanamosl@gmail.com>, "truform techno" <pidfpinfg@truformdftechnoproducts.com>, "NiTsdfeSh ThIdfsKaRe" <nthfsskare@ysahoo.in>, "akasdfsh kasdfstla" <akashkatsdfsa@yahsdfsfoo.in>, "Bisdsdfamal Prakaasdsh" <bimsdaalprakash@live.com>,; "milisdfsfnd ansdfasdfnsftwar" <dfdmilifsd.ensfdfcogndfdfatia@gmail.com>').match(re);
    
    //["sdabhikagathara@rediffmail.com", "dsfassdfhsdfarkal@gmail.com", "rfernsdfson@gmail.com", "gyfanamosl@gmail.com", "pidfpinfg@truformdftechnoproducts.com", "nthfsskare@ysahoo.in", "akashkatsdfsa@yahsdfsfoo.in", "bimsdaalprakash@live.com", "dfdmilifsd.ensfdfcogndfdfatia@gmail.com"]
    
    0 讨论(0)
提交回复
热议问题