Hi,
You can use preg_match to see if two users use the same domain name.
But that don’t mean that they are working in the same company.
If the domain name is gmail.com or yahoo.com ?
You can use another method, asking users theire company names during registration.
With this method, the company name should be unique so that you can use it as an ID.