how do I search domain names by registrant? how can this be done programatically?
I haven't had any experience with programatically, but whois
was the method of choice "back in the day". A look at the wikipedia entry will give you some pointers to library implementations.
The problem has no solution, for the reasons explained in a comment by user170564. There are a lot of domains names, in many registries (not only at the second level, there are also domains underneath). These domains names are not indexed by registrant name (and for good reasons, think of privacy issues).
This being said, a few ideas:
if you know the handle of the registrant, some registries allow you to search all the domains by the same registrant, in this specific registry,
some companies gather data from many registries and sell access (to allow harassment of the registrants).