Extract email addresses from a text file using JavaScript

后端 未结 7 546
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 09:42

I have more than 2000 email addresses. which i have exported from feedburner. And the email address look like below;

    adminvicky@gmail.com   Active  12/05         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 10:09

    I would use string.split(" ") and split the textfile at its spaces.

    Example:

    var string = "    adminvicky@gmail.com   Active  12/05/2015  03:07   adminvishal250@gmail.com   Pending Verification 8/05/2015  01:07"
    var array = string.split(" ");
    var emails = [];
    for(var i = 0; i < array.length; i++){
        if(array[i].indexOf("@") != -1){
           emails.push(array[i]);
        }
    };
    

    Then you have an array emails which contains your email adresses.

提交回复
热议问题