Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    HOW TO ELIMINATE THE TEXT THAT IS REPEATED WITH NOTEPAD

    General Discussion
    2
    3
    963
    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.
    • ani rodet
      ani rodet last edited by

      Good afternoon friends, can you help me eliminate the text that is repeated in the lines?

      024 - This is normal text (IP) 024 - This is normal text (IP)
      ABC ABC
      test test test
      This is normal text.
      This is normal text.xxx This is normal text.
      This is normal text. xxx This is normal text.
      This is normal text. xxx This is normal text.
      This is duplicate text. 1234 This is duplicate text.
      This is duplicate text. YYYY This is duplicate text.
      This is duplicate text. JJJKKK This is duplicate text.
      This is duplicate text. PPPkl This is duplicate text.

      RESULT

      024 - This is normal text (IP)
      ABC
      test
      This is normal text.
      This is normal text.xxx
      This is normal text. xxx
      This is normal text. xxx
      This is duplicate text. 1234
      This is duplicate text. YYYY
      This is duplicate text. JJJKKK
      This is duplicate text. PPPkl

      How could I do it?

      1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones last edited by

        It’s hard to get everything you wanted, without getting matches you don’t want.

        Some questions that will help craft a better answer:

        • Do all the “repeated text” start at the beginning of the line? Or do you want to be able to change “Unique common. Middle common.” => “Unique common. Middle”?
        • I’m having trouble seeing to to expect “test test test” to match and delete twice, since “test test test” also matches the pattern “common middle common”
        • Does the final match always have to be at the end of the line, or could it be “Common Middle Common End” => “Common Middle End”?

        I came up with one that I think does what you intend, assuming the “common” must start the line, and no “end” allowed after a match-to-be-deleted:

        • find = (?-s)^(.+)(\h*.*?)(\h*\1\h*)+$
        • replace = \1\2

        Converts

        024 - This is normal text (IP) 024 - This is normal text (IP)
        ABC ABC
        test test test
        This is normal text.
        This is normal text.xxx This is normal text.
        This is normal text. xxx This is normal text.
        This is normal text. xxx This is normal text.
        This is duplicate text. 1234 This is duplicate text.
        This is duplicate text. YYYY This is duplicate text.
        This is duplicate text. JJJKKK This is duplicate text.
        This is duplicate text. PPPkl This is duplicate text.
        

        to

        024 - This is normal text (IP) 
        ABC 
        test 
        This is normal text.
        This is normal text.xxx
        This is normal text. xxx
        This is normal text. xxx
        This is duplicate text. 1234
        This is duplicate text. YYYY
        This is duplicate text. JJJKKK
        This is duplicate text. PPPkl
        
        1 Reply Last reply Reply Quote 0
        • ani rodet
          ani rodet last edited by

          thanks you very much

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors