I am developing a system where I have a textarea where I can add
- email address (Eg: rob@example.com)
- domain name (Eg: example.com)
- subdomain name (Eg: subdomain.example.com)
- 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:
-
rob@example.com will block rob@example.com
-
example.com will block {any_username}@example.com and also {any_username}@{any_subdomain}.example.com
-
subdomain.example.com will only block {any_username}@subdomain.example.com
-
* 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?