I have a different domains for example like:
https://www.google.com
https://www.google.de
https://www.google.co.uk
https://www.google.com/randompath
https://www.google.de/randompath
https://www.google.co.uk/randompath
I need to extract only the Top-Level Domain for every possible link. For this example it would be .com .de .co.uk ....
The regular expression I tried:
/\.[^.]{2,3}(?:\.[^.]{2,3})?$/
Only works, when there is no more path after the top-level domain. Does someone have a solution?