From 0ba07a6ee6c830b57fa4a89e3af3ed7504ff1bab Mon Sep 17 00:00:00 2001 From: JameelJiwani Date: Tue, 5 Dec 2023 13:02:51 -0500 Subject: [PATCH] Update regex to support empty strings Modified the existing regex to ignore escape characters at the end of the value https://regex101.com/r/L4RrR8/1 --- ios/ReactNativeConfig/ReadDotEnv.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/ReactNativeConfig/ReadDotEnv.rb b/ios/ReactNativeConfig/ReadDotEnv.rb index 6f809140..e1d59b34 100755 --- a/ios/ReactNativeConfig/ReadDotEnv.rb +++ b/ios/ReactNativeConfig/ReadDotEnv.rb @@ -21,8 +21,8 @@ def read_dot_env(envs_root) end dotenv = begin - # https://regex101.com/r/cbm5Tp/1 - dotenv_pattern = /^(?:export\s+|)(?[[:alnum:]_]+)\s*=\s*((?["'])?(?.*?[^\\])\k?|)$/ + # https://regex101.com/r/L4RrR8/1 + dotenv_pattern = /^(?:export\s+|)(?[[:alnum:]_]+)\s*=\s*((?["'])?(?.*?)\k?|)$/ path = File.expand_path(File.join(envs_root, file.to_s)) if File.exist?(path)