• Login
Community
  • Login

How to extract a certain text from lines with notepad?

Scheduled Pinned Locked Moved General Discussion
3 Posts 3 Posters 2.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    ani rodet
    last edited by Oct 9, 2018, 2:45 AM

    How are you friends ?, I hope that well, I hope you can help me I have a txt with 12678 lines and I need to separate
    the email with your address, the lines are like this
    email:addresss
    fami67@makil.com :avstree568 — -phonenumber 455678 number
    johon@yahoo.com :bernu34 4567ytru http://www .
    hasmnin@hotmail.com :californiaUD direction http://www . 5903
    .
    .
    .
    .

    The result I need is:

    fami67@makil.com :avstree568
    johon@yahoo.com :bernu34
    hasmnin@hotmail.com :californiaUD

    I await your prompt reply
    Thank you

    S 1 Reply Last reply Oct 9, 2018, 12:10 PM Reply Quote 0
    • G
      guy038
      last edited by guy038 Oct 9, 2018, 11:30 AM Oct 9, 2018, 9:46 AM

      Hello, @ani-rodet,

      Please, before trying to " think regex ", anyone should get into the habit of expressing its problem, in natural language, first, taking into account all its data ;-))

      In your case, you want to : delete the ending part of each line, beginning with the first space character of that line

      Then, the regex equivalent is quite easy to find out !

      SEARCH (?-s)\h.+

      REPLACE Leave EMPTY

      Notes :

      • As usual, the (?-s) modifier means that the dot . will match a single standard character, only ( not EOL ones )

      • Then, \h matches any horizontal blank character ( the space char \x{0020}, the tabulation char ( \x{0009} and the no-break space character \x{00a0} )

      • The final part .+ matches any non-null range of standard characters, after the horizontal blank char, till the end of each line

      • As the data matched have to be deleted, the replacement zone must stay empty

      Best Regards

      guy038

      1 Reply Last reply Reply Quote 1
      • S
        Scott Sumner @ani rodet
        last edited by Oct 9, 2018, 12:10 PM

        @ani-rodet

        This post looks very similar to this thread created by you. I think that if you post again with such questions, you should also show us WHAT YOU TRIED ON YOUR OWN before you posted. Otherwise it simply seems like the people supporting this Community are just doing your work for you (instead of giving you hints/help) and you should pay them for that help.

        And “I await your prompt reply” in such a context…is offensive.

        1 Reply Last reply Reply Quote 1
        3 out of 3
        • First post
          3/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors