Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second level domain support #1

Closed
bjarneo opened this issue Jan 21, 2017 · 20 comments
Closed

Second level domain support #1

bjarneo opened this issue Jan 21, 2017 · 20 comments

Comments

@bjarneo
Copy link
Owner

bjarneo commented Jan 21, 2017

https://en.wikipedia.org/wiki/Second-level_domain

*.co.uk

@jamesjara
Copy link

+1

@bjarneo
Copy link
Owner Author

bjarneo commented Aug 10, 2017

I'm still trying to figure ut a pattern to solve this though. Since I don't use regex.

@Kikobeats
Copy link

exists a regex for do that?

@bjarneo
Copy link
Owner Author

bjarneo commented Dec 12, 2017

Yeah, it exists. This code was initially trying to extract the hostname/domain without the use of regex, but I am considering switching to regex since this code is not that performant any more.

@Kikobeats
Copy link

Inspiration: https://github.com/peerigon/parse-domain

@Kikobeats
Copy link

@bjarneo
Copy link
Owner Author

bjarneo commented Jan 22, 2018

Thanks for links. This issue has been open for a year now. I think I'll revisit the logic today (and this week). Try to get a new release with second level domain support :)

@Kikobeats
Copy link

let me if you need help 🙂

@bjarneo
Copy link
Owner Author

bjarneo commented Mar 16, 2018

I'm so slow at github at the moment. :|

But, I'm looking into actually create this domain extraction the same as creating a programming language. Create a parser, tokenizer and ast. Not sure how performant that will be, but just for the fun of it. Then it will probably be much easier to extract the second level domain.

However, I guess an approach where we just use regex would be faster though.

@bjarneo
Copy link
Owner Author

bjarneo commented Mar 21, 2018

Have been investigating SLDs, regex, and such. This is a tricky thing to do.

Seems that I actually need a list of SLDs to do this.

Will continue investigating.

@bjarneo
Copy link
Owner Author

bjarneo commented Mar 21, 2018

Nice place to test regex. This is just a simple test by checking for dots and words: https://regex101.com/r/2Gd219/1

@bjarneo
Copy link
Owner Author

bjarneo commented Mar 21, 2018

One easy approach would be returning subdomain.domain.co.uk, but then again, it will not behave as I expect this library to behave.

@ddemid
Copy link

ddemid commented Jun 14, 2018

+1

@bjarneo
Copy link
Owner Author

bjarneo commented Jun 13, 2019

Two years later, a "hack" for second level domain support is added. All tests are passing.

@bjarneo bjarneo closed this as completed Jun 13, 2019
@bjarneo
Copy link
Owner Author

bjarneo commented Jun 13, 2019

Nope. Forgot about sub domains. This "hack" didn't work. Reverting.

@bjarneo bjarneo reopened this Jun 13, 2019
@danipolo
Copy link

+1 !!!

@misner
Copy link

misner commented Jul 30, 2019

+1

@LeCoupa
Copy link

LeCoupa commented Apr 27, 2020

You can check how this package is doing it to validate second-level domains.

https://github.com/miguelmota/is-valid-domain

@bjarneo
Copy link
Owner Author

bjarneo commented Apr 28, 2021

Here is the PR with details: #7

@bjarneo bjarneo closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants