So far I've got the following regex that matches against regular domains but not domains with underscores. Example: _tcp._sip.45.example.com. Any help would be greatly appreciated.
(?P<name>([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})