Remove certain section from a lot of links
-
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
-
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. -
@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.
-
This post is deleted!