Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dotenv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
r"""
(
\s* # leading whitespace
(?:export\s+)? # export
(?:export{0}+)? # export

( '[^']+' # single-quoted key
| [^=\#\s]+ # or unquoted key
)?

(?:
(?:\s*=\s*) # equal sign
(?:{0}*={0}*) # equal sign

( '(?:\\'|[^'])*' # single-quoted value
| "(?:\\"|[^"])*" # or double-quoted value
Expand All @@ -40,7 +40,7 @@
(?:\#[^\r\n]*)? # comment
(?:\r|\n|\r\n)? # newline
)
""",
""".format(r'[^\S\r\n]'),
re.MULTILINE | re.VERBOSE,
)

Expand Down
7 changes: 7 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def restore_os_environ():
Binding(key="c", value="d", original="c=d"),
],
),
(
'a=\nb=c',
[
Binding(key="a", value='', original='a=\n'),
Binding(key="b", value='c', original="b=c"),
]
),
(
'a="\nb=c',
[
Expand Down