Finding out if a given email address falls under blacklisted item

I am developing a system where I have a textarea where I can add

  1. email address (Eg: rob@example.com)
  2. domain name (Eg: example.com)
  3. subdomain name (Eg: subdomain.example.com)
  4. wildcard (an astix *)

These items can either be separated by comma (,) or each item in a new line. These items will act as a list of blacklisted items. A user trying to signup using any of the above should not be allowed to signup. Here is how the system should behave:

  1. rob@example.com will block rob@example.com

  2. example.com will block {any_username}@example.com and also {any_username}@{any_subdomain}.example.com

  3. subdomain.example.com will only block {any_username}@subdomain.example.com

  4. * will block {any_username}@{any_domain} and also {any_username}@{any_subdomain}.{any_domain}

I am struggling to write a logic that could prevent a user to signup using the above logic.

Can someone please help?

what code have you made to try this on your own? maybe a translation to regex will help you. using regex as input format would be easy to verify and expand.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.