diff --git a/src/Console/SailEnvCommand.php b/src/Console/SailEnvCommand.php index f7ebf8f..d17c62b 100644 --- a/src/Console/SailEnvCommand.php +++ b/src/Console/SailEnvCommand.php @@ -59,7 +59,7 @@ protected function getServicesFromDockerCompose(): array $dockerComposeContent = file_get_contents($this->laravel->basePath('docker-compose.yml')); $regex = '/'.implode('|', array_map(function ($service) { - return '(?<=\s)'.$service.'(?=:)'; // Match service name followed by ':' (e.g. mysql:) and preceded by whitespace + return '(?<=[^\S]\s)'.$service.'(?=:)'; // Match service name followed by ':' (e.g. mysql:) and preceded only by whitespace }, $this->services)).'/'; preg_match_all($regex, $dockerComposeContent, $matches);