RegularExpression: match and extract long domain

Multi tool use


RegularExpression: match and extract long domain
I want to match and extract domain form strings,and I got an equation:
result = re.findall(r"(^((?!-))(xn--)?[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}.(xn--)?([a-z0-9-]{1,61}|[a-z0-9-]{1,30}.[a-z]{2,})$)", text)
It does well for domain like :
example.org
example.org.eu
but it cannot work for domain like :
sub_example.example.org.eu
so,I am asking for helping improving the equation.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.