如何从长文本文件中仅获取电子邮件 ID?

如何从长文本文件中仅获取电子邮件 ID?

我有一个包含 1000 多个单词的文本文件。此文本文件还包含几封电子邮件。我只想从文本文件中获取所有这些电子邮件。有人能帮帮我吗?我在 notepad++ 中尝试了几种方法,但无法正确创建正则表达式来获取电子邮件。

以下是一个示例:

{
    {
        "freshers": [{
            "last_name": "Dharmani",
            "uid": 14429319,
            "mail": "[email protected]",
            "skill_knowns": ["7",
            "3"],
            "mobile_no": "asnbncbnabsnm",
            "hq_mark_type": "cgpa",
            "course_id": "16",
            "university_name": "gujarat technological university",
            "branch_id": "177",
            "first_name": "Anisha",
            "course_name": "BE\/B.Tech",
            "institute_state_id": "11",
            "date_of_birth": "13-October-1992",
            "last_login": "30-Nov-2015",
            "candidate_state_name": "Gujarat",
            "candidate_city_id": "43",
            "status": 1,
            "freshers_category": "20",
            "institute_state_name": "Gujarat",
            "candidate_city_name": "Vadodara",
            "institute_name": "Sardar Vallabhbhai Patel Institute of Technology, Vasad",
            "contact_no": "3012307",
            "branch_name": "Information Science\/Technology (IS\/IT)",
            "skill_academic": ["3",
            "14",
            "8",
            "3",
            "14",
            "8",
            "3",
            "14",
            "8"],
            "candidate_state_id": "11",
            "resume_path": "upload-resume\/2015\/11\/30\/resume_14429319_1448873130.pdf",
            "qualification_type": "Graduation",
            "mobile_verify": "0",
            "src": "",
            "branch_short_name": "IT",
            "created": "23-Feb-2015",
            "hq_institute_id": "294622",
            "gender": "Female",
            "fw_id": "FW16774601",
            "picture_path": "file\/9593b209f58991f2132e4ac556de28d2.jpg",
            "hq_mark": 7.8,
            "skills": "ASP.NET,C++,HTML,MicroSoft(MS)SQL,Ajax,C#,CSS,JavaSript",
            "is_resume_available": "1",
            "hq_passout_year": 2015
        },
        {
            "last_name": "Chanda",
            "uid": 14727731,
            "mail": "[email protected]",
            "mobile_no": "alsjhasljals",
            "hq_mark_type": "percentage",
            "course_id": "16",
            "university_name": "Nagpur University",
            "branch_id": "177",
            "first_name": "Ansumitra",
            "course_name": "BE\/B.Tech",
            "institute_state_id": "20",
            "date_of_birth": "05-July-1989",
            "last_login": "30-Nov-2015",
            "candidate_state_name": "Karnataka",
            "candidate_city_id": "65",
            "status": 1,
            "freshers_category": "20",
            "institute_state_name": "Maharashtra",
            "candidate_city_name": "Bangalore",
            "institute_name": "Priyadarshini College of Engineering, Nagpur",
            "contact_no": "",
            "branch_name": "Information Science\/Technology (IS\/IT)",
            "candidate_state_id": "16",
            "resume_path": "upload-resume\/2015\/09\/12\/resume_14727731_1442002613.doc",
            "qualification_type": "Graduation",
            "mobile_verify": "0",
            "src": "home_link2",
            "branch_short_name": "IT",
            "created": "15-Jun-2015",
            "hq_institute_id": "318237",
            "gender": "Female",
            "fw_id": "FW17072975",
            "picture_path": "",
            "hq_mark": 58,
            "is_resume_available": "1",
            "hq_passout_year": 2015
        },
        {
            "last_name": "mp",
            "uid": 15056653,
            "mail": "[email protected]",
            "mobile_no": "klasjklajskjasl",
            "hq_mark_type": "percentage",
            "course_id": "16",
            "university_name": "Visveswaraiah Technological University",
            "branch_id": "177",
            "first_name": "Shruthi",
            "course_name": "BE\/B.Tech",
            "institute_state_id": "16",
            "date_of_birth": "12-May-1993",
            "last_login": "30-Nov-2015",
            "candidate_state_name": "Karnataka",
            "candidate_city_id": "65",
            "status": 1,
            "freshers_category": "20",
            "candidate_sublocation_id": "6",
            "institute_state_name": "Karnataka",
            "candidate_city_name": "Bangalore",
            "job_type": "0,Full Time,0",
            "institute_name": "East West Institute of Technology (EWIT), Bangalore",
            "contact_no": "",
            "branch_name": "Information Science\/Technology (IS\/IT)",
            "candidate_state_id": "0",
            "resume_path": "upload-resume\/2015\/11\/27\/resume_15056653_1448614939.docx",
            "qualification_type": "Graduation",
            "mobile_verify": "0",
            "src": "short_reg",
            "branch_short_name": "IT",
            "created": "08-Sep-2015",
            "hq_institute_id": "1363",
            "gender": "Female",
            "fw_id": "FW17401821",
            "picture_path": "",
            "hq_mark": 66.29,
            "skills": "",
            "is_resume_available": "1",
            "hq_passout_year": 2015,
            "candidate_sublocation_name": "Basavanagudi "
        },
        {
            "last_name": "Lakshmi",
            "uid": 14521915,
            "mail": "[email protected]",
            "skill_knowns": ["6",
            "7",
            "164"],
            "mobile_no": "ajlshjahsjahs",
            "hq_mark_type": "percentage",
            "course_id": "16",
            "university_name": "Visveswaraiah Technological University",
            "branch_id": "177",
            "first_name": "Vinaya",
            "course_name": "BE\/B.Tech",
            "institute_state_id": "16",
            "date_of_birth": "14-February-1994",
            "last_login": "30-Nov-2015",
            "candidate_state_name": "Karnataka",
            "candidate_city_id": "65",
            "status": 1,
            "freshers_category": "20",
            "candidate_sublocation_id": "16",
            "institute_state_name": "Karnataka",
            "candidate_city_name": "Bangalore",
            "job_type": "0,Full Time,0",
            "institute_name": "Vivekananda College Of Engineering And Technology (VCET), Puttur",
            "contact_no": "25
        }

答案1

您可以尝试以下正则表达式

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}

我正在为我的客户使用相同的正则表达式。希望它能有所帮助。

相关内容