Regex for URL with specified Domain or a signed URL

I want to match a url to replace it on demand in Python. the url looks like:

https://storage.googleapis.com/icontent/media/2022-12-21%2.jpg?Expires=16344&AccessId=icontent-web.gservice.com&Signature=[alplanumeric characters]

anyother url that isnt this way should not match.

For now, I'm using a general url regex and filtering based on the domain name.

regex I'm using is :

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)

i want to replace this inside the src attributes and update the expired url on demand.

Any help would be appreciated. Thanks .

Back to Top