I'm trying to preg replace a string and remove from it all URLs which do not contain current domain.
So far I got this regex, but it does not exclude mydomain. What I'm doing wrong?
http[s]?:\/\/[w]{0,3}\.{0,1}((?<!mydomain)[^\.].*)
Expected input and output:
http://regex101. => should match
http://www.regex101. => should match
https://regex101. => should match
https://www.regex101. => should match
https://www.mydomain. => should not match, but it does
https://regex101.com/r/kGil9O/1
I've read several SO questions/answers and either they don't work for my case, either are somehow different. When answer, please explain where I was wrong so I could be better next time. Thanks!