From caab3b8701405a446489a7864f91a2c9f281eee0 Mon Sep 17 00:00:00 2001 From: Michael Rosenfeld Date: Fri, 12 Jun 2026 15:24:20 -0400 Subject: [PATCH] fix(hooks): make env var regex portable Adjust the regex used to detect ${ENV_VAR} patterns in hooks/_common.sh to avoid Bash-incompatible constructs and to be compatible with macOS/BSD regex behavior. - Remove unnecessary leading/trailing '.*' since =~ matches substrings. - Allow lowercase letters in subsequent identifier characters ([A-Za-z0-9_]) so variable names with lowercase chars are detected. - Keep first-char restriction to uppercase or underscore to match existing extraction logic. Signed-off-by: Michael Rosenfeld --- hooks/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/_common.sh b/hooks/_common.sh index 5808c19..59236fd 100644 --- a/hooks/_common.sh +++ b/hooks/_common.sh @@ -112,7 +112,7 @@ function common::parse_and_export_env_vars { while true; do # Check if at least 1 env var exists in `$arg` # shellcheck disable=SC2016 # '${' should not be expanded - if [[ "$arg" =~ .*'${'[A-Z_][A-Z0-9_]*'}'.* ]]; then + if [[ "$arg" =~ '${'[A-Z_][A-Za-z0-9_]*'}' ]]; then # Get `ENV_VAR` from `.*${ENV_VAR}.*` local env_var_name=${arg#*$\{} env_var_name=${env_var_name%%\}*}