nebius/SWE-bench-extra huggingface dataset:
Repository: thesimj/envyaml

Issue:
Parsing fails with inline list
I had the below structure in a config file and the parsing 

```
mail:
    to: [ $HANDLERS_SMTP_TO ]
```

I get the following error
`ValueError: Strict mode enabled, variable $SMTP_HANDLER_TO] not defined!`

The below works just fine though

```
mail:
    to:
        - $HANDLERS_SMTP_TO
```

Comments:

Patch:
diff --git a/envyaml/envyaml.py b/envyaml/envyaml.py
index d02118a..e0ba807 100644
--- a/envyaml/envyaml.py
+++ b/envyaml/envyaml.py
@@ -30,15 +30,21 @@ RE_COMMENTS = re.compile(r"(^#.*\n)", re.MULTILINE | re.UNICODE)
 RE_DOT_ENV = re.compile(r"^((?!\d)[\w\- ]+=.*)$", re.MULTILINE | re.UNICODE)
 
 RE_ENV = [
-    (re.compile(r"(?<=\$\{)(.*?)(?=\})", re.MULTILINE | re.UNICODE), ["${{{match}}}"]),
+    (
+        re.compile(r"(?<=\$\{)(.*?)(?=\})", re.MULTILINE | re.UNICODE),
+        ["${{{match}}}"]
+    ),
     (
         re.compile(r"(?<=[\"\']\$)(.*?)(?=[\"\']$)", re.MULTILINE | re.UNICODE),
         ['"${match}"', "'${match}'"],
     ),
-    (re.compile(r"\$(?!\d)(.*)", re.MULTILINE | re.UNICODE), ["{match}"]),
+    (
+        re.compile(r"\$(?!\d)(.*)(?<![\s\]])", re.MULTILINE | re.UNICODE),
+        ["{match}"]
+    ),
 ]
 
-__version__ = "1.1.201202"
+__version__ = "1.2.201222"
 
 
 class EnvYAML:
@@ -138,8 +144,8 @@ class EnvYAML:
                 name, value = line.strip().split("=", 1)  # type: str,str
 
                 # strip names and values
-                name = name.strip().strip("'\"")
-                value = value.strip().strip("'\"")
+                name = name.strip().strip("'\" ")
+                value = value.strip().strip("'\" ")
 
                 # set config
                 config[name] = value


Test patch:
diff --git a/tests/env.test.yaml b/tests/env.test.yaml
index 156ae33..7f97a5c 100644
--- a/tests/env.test.yaml
+++ b/tests/env.test.yaml
@@ -77,6 +77,9 @@ empty:
   novalues:
   noenvvalue: $EMPTY_ENV|""
 
+var_in_array:
+  to: [ $USERNAME ]
+
 #
 # Comments
 #
diff --git a/tests/test_envyaml.py b/tests/test_envyaml.py
index dba827a..b45941f 100644
--- a/tests/test_envyaml.py
+++ b/tests/test_envyaml.py
@@ -284,3 +284,10 @@ def test_it_should_return_proper_formatted_string():
 def test_it_should_raise_exception_in_strict_mode():
     with pytest.raises(ValueError):
         EnvYAML("tests/env.ignored.yaml")
+
+
+def test_it_should_parser_environment_inside_array_and_object():
+    env = EnvYAML("tests/env.test.yaml", env_file="tests/test.env")
+
+    # assert array
+    assert env['var_in_array.to.0'] == 'env-username'