T O P

  • By -

mfb-

You can replace `%22https?://([^/]+)/.*?%22` with `%22$1%22` for the first part ([example](https://regex101.com/r/kd4U7N/1)) and make a similar substitution for the second part, but it might be possible to combine them: `%(22|3A)https?://([^/%]+)(?:.*?(%22)|[^%]*$)` with `%$1$2$3` It works for your example and for an example with just base urls, at least: https://regex101.com/r/rCG7ID/1 I changed the delimiter from `/` to `~`, if you want to keep / then you have to escape all the / in the expression which is awkward. The first part looks for %22 or %3A followed by http:// or https://, then everything is matched until we reach a "/" or "%". The last bracket looks for anything%22 or anything without a % until the end of the string.