I would like a regex to find a bunch of URLs but with the same domain.

Here's for example what I'm trying to find (and replace)


The concept is, the regex will be able to find any url containing that domain and ending with a )

Thank you.

  • What is wanted replacement? Please, edit your question and add some lines and expected result. – Toto Sep 15 at 8:39
  • The replacement is really not important, for the moment I'm looking for how to match with that pattern that starts with that domain and ends with a ")". – Varulv Sep 15 at 12:20

This could be one option.

Explanation as follow:
^ match start of line
. is a wildcard that will match any single character
* will match the previous element zero or more times
I.e .* will match any character zero or more times

In \. and \) the backslash will escape to literally match the dot . and the parenthesis )

$ will match end of string

You will have to untick the . matches newline option.
. matches new line picture

| improve this answer | |
  • Hi, thank you for your help, that actually matches all links except for the ones I'm looking for (with that domain exactly). – Varulv Sep 15 at 13:02
  • How did it go? Did you find the solution? You can always update with writing your own answer. If not, maybe you can give a more detailed example, like an extended text of the URLs and exactly what you expect to match and not match. It would make it easier to help you further. Did you elaborate on the page @8ctopus recommended? What was your outcome from that? – akane Sep 29 at 3:38
  • I did not succeed using any regex, I eventually gave up and replaced everything manually. I still can't get your solution to work for similar situations or I would've gladly accepted it as an answer. – Varulv Sep 29 at 10:33

Iterating on @akane's answer and knowing replacements will be involved later on, I would suggest capturing the different parts as follows


Experiment with the regex: https://regex101.com/r/gNG8AN/1.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.