diff --git a/nomad/parsing/parser.py b/nomad/parsing/parser.py
index 092d4ef5080b2acb1c79389c8caf0d2628df0578..f571e88690f2212c9c7d375955f5354df62cca18 100644
--- a/nomad/parsing/parser.py
+++ b/nomad/parsing/parser.py
@@ -362,11 +362,13 @@ class MatchingParser(Parser):
 
                 try:
                     comment = self._mainfile_contents_dict.get('__comment_symbol', None)
-                    self._mainfile_contents_dict.pop('__comment_symbol', None)
+                    tmp = self._mainfile_contents_dict.pop('__comment_symbol', None)
                     table_data = read_table_data(filename, comment=comment)[0]
                     data = table_data.to_dict()
 
                     is_match = match(self._mainfile_contents_dict, data)
+                    if tmp:
+                        self._mainfile_contents_dict.update({'__comment_symbol': tmp})
                 except Exception:
                     pass
             if not is_match: