I am developing a system where each user will have his subdomain according to his login but also will allow him to configure his own domain.
As I'm developing locally, I've also added a few rules to make everything work on my local machine.
To solve my problem I started to make a regex for if it does not have certain strings it does not let pass but I do not know how to allow others.
For example this list of domains:
sistema.com.br // não pode casar
local.dev // não pode casar
cliente.local.dev // tem que casar
cliente.sistema.com.br // tem que casar
app.sistema.com.br // não pode casar essa
app.local.dev // não pode casar essa
www.dominio.com.br // regex casa, já está certo
subdominio.dominio.com.br // tem que casar
dominio.com.br // regex casa, já está certo
Currently my regular expression looks like this:
^(?!.*(sistema\.com\.br|local\.dev)).*$
What I need to work out is that this regex matches the subdomains any but the app
subdomain and also could not match the main domains sistema.com.br
and local.dev
I'm not finding a solution as I'm still not sure how to work with denied lists along with allowed lists.
Summarizing what I'm trying to do is marry any domain (including domains with subdomains) minus those from the list below:
sistema.com.br
local.dev
app.sistema.com.br
app.sistema.dev