It was fun to find a solution to your question. I made the below query to check it out. Modify this to your requirement.
Run the below query in your splunk search
index=main | head 1 | eval custom_test="This . is . Eashwar . Raghunathan . and . i . am . playing . with . 10 . dots" | rex mode=sed field=custom_test "s/[^.]/X/g s/X//g" | eval NumberOfDots=len(custom_test) | table custom_test NumberOfDots
Hope in your case you will pass the string domain instead of custom_test
Happy splunking bro, thanks for asking tough questions 🙂