# Topic "popular links" panel domain extraction doesn't handle country TLDs

**URL:** <https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156>\
**Category:** Bug\
**Created:** [March 30, 2017, 4:32am UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156 "2017-03-30T04:32:15Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 31, 2017, 9:53am UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156/10 "2017-03-31T09:53:15Z")

</div>

Hmm that’s pretty nasty.. can’t say I am a fan.

Couldn’t we have a simple regex that allows a few 2 and 3 letter dotted phrases at the end?

`\w{3,}\.\w{1,3}(\.\w{1,3})$`

TLDs are a pain though, if they are long like `funky.community`… stuff is gonna break. I guess the general logic would be

- grab the rightmost period and word chars next to it
- if it is too short, grab the next leftward period and word too

This would handle `com.au` as it is clearly way too short to be a real domain. `com.com` is also too short, I think. so the threshold is “must be more than 7 chars with just one period”

---

_[View the full topic](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156)._
