diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5da5a01..a65dcd9 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -10,6 +10,7 @@
   See the License for more information.
 ============================================================================*/
 #include "cmFileCommand.h"
+#include "cmStringCommand.h"
 #include "cmake.h"
 #include "cmHexFileConverter.h"
 #include "cmInstallType.h"
@@ -582,6 +583,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
   std::vector<std::string> strings;
   std::string s;
   int c;
+  cmStringCommand::ClearMatches(this->Makefile);
   while((!limit_count || strings.size() < limit_count) &&
         (limit_input < 0 || static_cast<int>(fin.tellg()) < limit_input) &&
         (c = fin.get(), fin))
@@ -601,6 +603,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
           break;
           }
         strings.push_back(s);
+        cmStringCommand::StoreMatches(this->Makefile, regex);
         }
 
       // Reset the string to empty.
