Projects / libtld


libtld is a library used to extract the TLD from a URI and to check email validity. This allows you to extract the exact domain name, sub-domains, and all the TLD (top level, second level, third level, etc.). The problem with TLDs is that you cannot know where the domain starts. Some domains can use one top-level domain, others use two, etc. However, it may be useful to know where the domain is to have the exact list of sub-domains. For example, if you want to force www. at the start of the domain name if no other sub-domains are specified, then you need to know exactly how many TLD are defined in a URI. The libtld offers one main function: tld(), which gives you a way to extract the TLD from any URI. The result is the offset where the TLD starts. This gives you enough information to extract everything else you need. For emails, the library is capable of parsing a string that represents a list of email addresses to be verified. The verification includes a check of the domain name and its TLD.

Operating Systems

RSS Recent releases

  •  23 Nov 2013 00:46

Release Notes: This release mainly streamlines the license information of the module, adding a Debian compatible copyright file to the debian directory and /usr/share/doc/libtld on install. It also includes a new set of cmake files; although at this point they're still shipped as part of this project, at some point these cmake scripts will become a separate project.

  •  24 Aug 2013 22:06

Release Notes: This is a patch with the few new TLDs added in the last few months.

  •  28 May 2013 19:47

Release Notes: This version adds a strong email check in C, C++, and PHP. It also strengthen the documentation and restructures the project environment with 100% coverage by the unit tests.

  •  18 Feb 2013 04:27

Release Notes: This release adds a C++ class to easily handle URIs in C++, adds a PHP extension so [check_]tld() can be used in PHP, adds a static version of the library, updates the TLDs as of Feb 2013, and fixes the TLD exceptions, which now return a valid answer.

  •  07 May 2012 22:51

Release Notes: Support for exceptions such as The tests have been update accordingly. A test for the XML file to make sure it respects the DTD has been added. This release fixes offsets in the data table, unsigned short and -1; it uses USHRT_MAX now. The .us entries are complete.


Project Spotlight


A Linux-based virtual tape library.


Project Spotlight


A tool to ease the execution of commands on multiple remote servers.