Find character ranges across multiple lines



  • My txt file has a lot of lines, each line can be any format.
    How to find email addresses in the form of : abc@abschool.com , bca@school.yahoo.ca , or abc@newyork.sjshschool.email.ca … It could be another email address. I need the result that the emails have a domain that contains " school ". What am I going to do? Thanks



  • @Kandice-Feliciano

    So if your text is like this:

    My txt file has a lot of lines, each line can be any format.
    How to find email addresses in the form of : abc@abschool.com , bca@school.yahoo.ca , or abc@newyork.sjshschool.email.ca … It could be another email address. I need the result that the emails have a domain that contains " school ". What am I going to do? Thanks
    

    I would do this:

    Do a Mark (Ctrl+m) operation like this:

    ca01c02f-ac91-49af-b636-f4082f4d1126-image.png

    Then press Copy Marked Text and paste into a new tab:

    abc@abschool.com
    bca@school.yahoo.ca
    abc@newyork.sjshschool.email.ca
    

    Do another Mark operation like this:

    6e064641-6282-4e22-8ba1-790bb2db8a3e-image.png

    Then right-click in the margin below the blue ball to get this menu:

    7e362e2a-f142-4830-af7e-cb17c8dd4467-image.png

    and choose Copy Bookmarked Lines.

    Now you have in the clipboard all of your email addresses with “school” in them.

    There are other ways; although I’m trying to “keep it simple”.



  • Thank you for your quick help. It is true that I have applied your way. But there are some lines that contain " school " that are also selected. While I just want to get email results that contain a domain that contains “school.” I’m sorry I’ve asked incomplete questions.



  • For example:
    school@yahoo.com
    abc@gmail.com, shools are there…
    These 2 lines are also selected, although I do not want to.
    That’s what I want to present.



  • @Kandice-Feliciano

    It seems like you could change the original second Mark above to:

    60770e39-6320-4e87-ab3a-f3230792973c-image.png



  • Exactly. That’s great. Thanks



  • Hello, @kandice-feliciano, @alan-kilborn and All,

    I initially thought of a regex, a bit more strict, regarding the e-mail address definition :

    SEARCH (?-i)\b\w([\w.]*)@[\w.]*school[\w.]*\.\w{2,}\b


    However, the Alan’s regex is more elegant. And I think that we may combine the two Mark operations in one step, with the following syntax :

    SEARCH / MARK (?-i)\S+@\S*school\S+

    Test it, against this text :

    abc@newyork.sjshschl.email.ca
    abc@abschool.com
    abc@abschol.com
    bca@school.yahoo.ca
    school@yahoo.com
    abc@newyork.sjshschool.email.ca
    bca@schoool.yahoo.ca 
    abc@gmail.com, shools are there…
    
    abc@newyork.sjshschl.email.ca, abc@abschool.com, abc@abschol.com, bca@school.yahoo.ca, school@yahoo.com, abc@newyork.sjshschool.email.ca, bca@schoool.yahoo.ca,  abc@gmail.com, shools are there…
    

    Best Regards,

    guy038



  • Thank you both. Thanks to the above 2 syntax I can rely on it to find any email address with a domain that I need. Since I very often use it to find emails on drive D or E. Previously this work took me quite a lot of time and trouble. Once again thank you 2


Log in to reply