Community
    • Login

    Need help deleting any text between other text

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.5k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          Imgema
          last edited by

          Thank you!

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors