fixed regex and conditional for .env export