Community
    • Login

    Need help deleting any text between other text

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 388 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.
    • ImgemaI
      Imgema
      last edited by PeterJones

      The scenario is this: I have thousands of lines that look like this:

      <Path>C:\random name\random name.zip<path>
      

      And i need it to be

      <Path>C:\random name.zip<path>
      

      Basically i need to delete the duplicated name in every line because those files are not in subfolders of the same name anymore.

      Thanks in advance!
      —

      moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Imgema
        last edited by

        @Imgema,

        FIND WHAT = \\(.*?)\\(\1)
        REPLACE WITH = \\$1
        SEARCH MODE = Regular Expression

        Explanation
        FIND:

        • \\ is a literal backslash
        • (.*?) says grab text and put it in group1
        • \\ until it hits the next backslash
        • (\1) says match the same text that was in group1

        REPLACE:

        • $1 refers to the contents of group1

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 4
        • ImgemaI
          Imgema
          last edited by

          Thank you!

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