File tree Expand file tree Collapse file tree 4 files changed +4
-1
lines changed
main/java/io/github/cdimascio/dotenv/internal Expand file tree Collapse file tree 4 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 1919public class DotenvParser {
2020
2121 private static final Pattern WHITE_SPACE_REGEX = Pattern .compile ("^\\ s*$" ); // ^\s*${'$'}
22- private static final Pattern DOTENV_ENTRY_REGEX = Pattern .compile ("^\\ s*([\\ w.\\ -]+)\\ s*(=)\\ s*(. *)?\\ s*$" ); // ^\s*([\w.\-]+)\s*(=)\s*(. *)?\s*$
22+ private static final Pattern DOTENV_ENTRY_REGEX = Pattern .compile ("^\\ s*([\\ w.\\ -]+)\\ s*(=)\\ s*([^#] *)?\\ s*(#.*)? $" ); // ^\s*([\w.\-]+)\s*(=)\s*([^#] *)?\s*(#.*)? $
2323
2424 private final DotenvReader reader ;
2525 private final boolean throwIfMissing ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ public class BasicTests {
1515 put ("MY_TEST_EV2" , "my test ev 2" );
1616 put ("WITHOUT_VALUE" , "" );
1717 put ("MULTI_LINE" , "hello\\ nworld" );
18+ put ("TRAILING_COMMENT" , "value" );
1819 }};
1920
2021 @ Test (expected = DotenvException .class )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ MY_TEST_EV1=my test ev 1
33MY_TEST_EV2 = my test ev 2
44WITHOUT_VALUE =
55MULTI_LINE = hello\nworld
6+ TRAILING_COMMENT = value # comment
67
78# # Malformed EV!
89MY_TEST_EV3
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ MY_TEST_EV1=my test ev 1
33MY_TEST_EV2=my test ev 2
44WITHOUT_VALUE=
55MULTI_LINE=hello\nworld
6+ TRAILING_COMMENT=value # comment
67
78## Malformed EV!
89MY_TEST_EV3
You can’t perform that action at this time.
0 commit comments