-
Notifications
You must be signed in to change notification settings - Fork 25
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
Easier way to check if a domain includes a valid TLD #27
Comments
Would a PR for this functionality be welcomed? |
Before we add new functionality to this library, would def valid_tld?(%URI{host: nil}), do: false
def valid_tld?(%URI{host: host}) do
PublicSuffix.registrable_domain(host) != nil
end |
Even though |
Interesting; it looks like we're falling back to the default rule in that case. This is correct according to the spec, but it makes the library substantially less useful. I like the
I'm thinking adding a similar option like |
That would work great for me! |
I know this issue is old, but since it's still open, I figure it might help someone else: sounds like the already existing
Of course simply "com" will also be true, but you could combine it with |
This is the function that we're currently using and it's been serving us well:
|
I have the given requirement, given an arbitrary string, check if any valid domains are listed in the string and highlight/linkify them. I already have a basic regex to split the string into potential domains.
I would like there to be a function in
PublicSuffix
that could more readily answer this. Right now I am using:Which I guess seems simple enough but it might be nice to have some sort of helper.
The text was updated successfully, but these errors were encountered: