I am using an API that does a WhoIs query to determine the availability of domains.
However, it seems every TLD gives a different type of response, so I have to create custom searches for each one:
result.match("No match for") //.com
result.match("NOT FOUND") //.info, .org
!result.match("Administrative")//.biz
result.match("Invalid query or domain")//.tk
!result.message.match("registered")//.ca
result.match("No Match")//.edu
result.match("Status: free")//.de
result.match("Not found:")//.de
There are hundreds more TLDs to go through. Surely this isn't the best way to do this. Is there a simpler way to determine if a domain has been registered or not?