Community

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

    Need help deleting any text between other text

    Help wanted · · · – – – · · ·
    2
    3
    39
    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.
    • Imgema
      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

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        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
        • Imgema
          Imgema last edited by

          Thank you!

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