diff --git a/documentation/samples/config b/documentation/samples/config
index 28ff1c96f54..fd38e39feb5 100644
--- a/documentation/samples/config
+++ b/documentation/samples/config
@@ -67,7 +67,7 @@ WINE REGISTRY Version 2
;"ShowDotFiles" = "1"
"ShellLinker" = "wineshelllink"
-#
+# [wineconf]
[Version]
; Windows version to imitate (win95,win98,winme,nt351,nt40,win2k,winxp,win20,win30,win31)
@@ -313,4 +313,4 @@ WINE REGISTRY Version 2
;[AppDefaults\\pickygame.exe\\dsound]
;"EmulDriver" = "N"
-#
+# [/wineconf]
diff --git a/tools/wineconf b/tools/wineconf
index b9310f57885..a9b5ed167c3 100755
--- a/tools/wineconf
+++ b/tools/wineconf
@@ -437,9 +437,9 @@ sub InsertDefaultFile {
if (open(DEFFILE, "$fileName")) {
while () {
- $state = 0 if ($state == 1 && $_ =~ /^[ \t]*\#/o && index($_, "$tag>") >= 0);
+ $state = 0 if ($state == 1 && $_ =~ /^[ \t]*\#/o && index($_, "[/$tag]") >= 0);
print $_ if ($state == 1);
- $state = 1 if ($state == 0 && $_ =~ /^[ \t]*\#/o && index($_, "<$tag>" ) >= 0);
+ $state = 1 if ($state == 0 && $_ =~ /^[ \t]*\#/o && index($_, "[$tag]" ) >= 0);
}
close(DEFFILE);
} else {