diff --git a/std/encoding/testdata/boolean.toml b/std/encoding/testdata/boolean.toml
index 242d29c969..e3e287981b 100644
--- a/std/encoding/testdata/boolean.toml
+++ b/std/encoding/testdata/boolean.toml
@@ -1,3 +1,4 @@
 [boolean] # i hate comments
 bool1 = true
-bool2 = false
\ No newline at end of file
+bool2 = false
+bool3 = true # I love comments
\ No newline at end of file
diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts
index 43788c06ac..336af97fb2 100644
--- a/std/encoding/toml.ts
+++ b/std/encoding/toml.ts
@@ -280,7 +280,7 @@ class Parser {
       return dataString.slice(0, endOfString);
     }
 
-    const m = /(?:|\[|{|).*(?:|\]||})\s*[^#]/g.exec(dataString);
+    const m = /(?:|\[|{).*(?:|\]|})\s*^((?!#).)*/g.exec(dataString);
     if (m) {
       return m[0].trim();
     } else {
diff --git a/std/encoding/toml_test.ts b/std/encoding/toml_test.ts
index 45d0a66e64..0a927cde9d 100644
--- a/std/encoding/toml_test.ts
+++ b/std/encoding/toml_test.ts
@@ -48,7 +48,7 @@ Deno.test({
 Deno.test({
   name: "[TOML] Boolean",
   fn(): void {
-    const expected = { boolean: { bool1: true, bool2: false } };
+    const expected = { boolean: { bool1: true, bool2: false, bool3: true } };
     const actual = parseFile(path.join(testFilesDir, "boolean.toml"));
     assertEquals(actual, expected);
   },