L
L
lexinti2020-04-24 19:57:50
Regular Expressions
lexinti, 2020-04-24 19:57:50

How to cut a link?

There are links in json
{"title":"01","file":" https://book.ru/a/5b011c5e0bd5c0582eba2cd9462b05b8... "}
{"title":"02","file":" https: //s1.book.ru/a/5b011c5e0bd5c0582eba2cd9462b0... "}

I need to replace " https://book.ru/a/5b011c5e0bd5c0582eba2cd9462b05b8... ", " https://s1.book.ru/a /5b011c5e0bd5c0582eba2cd9462b0... "
to
" books.site "
and turn into
https://books.site/38904/1/01.mp3
https://books.site/38904/1/02.mp3
Please tell me the universal regular expression to replace links

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-04-24
@dodo512

https://regex101.com/r/R3l2DM/1
Find: (https?://)[^/]+/\w/\w{32}/\d+/
Replace:$1books.site/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question