• Login
Community
  • Login

Remove certain section from a lot of links

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 4 Posters 471 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
    Amigo Barrio
    last edited by Oct 24, 2022, 7:54 AM

    Hello, I need to remove a certain section from a bunch of links.

    Here is the example:

    https://dev.umb-schiffsmodelle.com/wp-content/uploads/2022/10/22221603/Atlantic-L200-01.jpg, https://dev.umb-schiffsmodelle.com/wp-content/uploads/2022/10/22221615/Atlantic-L60-01.jpg, https://dev.umb-schiffsmodelle.com/wp-content/uploads/2022/10/22221626/Atlantic-L60-10.jpg, …

    I want need to remove the fat marked section. The problem is that it is always a different number…

    I hope, anyone can help me <3

    E G C 3 Replies Last reply Oct 24, 2022, 9:17 AM Reply Quote 0
    • E
      Ekopalypse @Amigo Barrio
      last edited by Oct 24, 2022, 9:17 AM

      @Amigo-Barrio

      If you want to process arbitrary text, you need to find out if there is a pattern that can be applied. In your example it looks like the text to be removed is always after a fixed text like https://dev.umb-schiffsmodelle.com/wp-content/uploads/2022/10. If this is also true of your real data, then you can be helped to build a regex that can handle it if you find a pattern to look for.

      1 Reply Last reply Reply Quote 1
      • G
        gerdb42 @Amigo Barrio
        last edited by Oct 24, 2022, 10:18 AM

        @Amigo-Barrio as Ekopalypse already stated you need to look for some kind of pattern to identify what has to be removed. In your case you have a fixed URL followed by some arbitrary digits followed by the name of a .jpg image. You may achieve the replacement using a Regular Expression (regex for short). The following will pick the entire URL, extract the fixed part and the .jpg name and re-join them omitting the digits:

        Search for: (https://dev.umb-schiffsmodelle.com/wp-content/uploads/2022/10/)\d+/(.+.jpg)
        Replace with: $1$2

        To fine-tune the regex you may want to have a look at this FAQ.

        1 Reply Last reply Reply Quote 1
        • C
          Click Sa @Amigo Barrio
          last edited by Aug 21, 2023, 6:14 AM

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