RegularExpression: match and extract long domain

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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.

nGYSKsmOhhdqH8fedBj9q
l1A3,s,ZtHgT C,og

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham