瀏覽代碼

BUG: Fixed regular expression used to match registry entries. The expression now matches everything after a [HKEY until the first ']' is encountered.

Brad King 24 年之前
父節點
當前提交
38d5b4a4c3
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Source/cmSystemTools.cxx

+ 7 - 1
Source/cmSystemTools.cxx

@@ -270,7 +270,13 @@ bool ReadAValue(std::string &res, const char *key)
 void cmSystemTools::ExpandRegistryValues(std::string& source)
 void cmSystemTools::ExpandRegistryValues(std::string& source)
 {
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #if defined(_WIN32) && !defined(__CYGWIN__)
-  cmRegularExpression regEntry("\\[(HKEY[A-Za-z0-9_~\\:\\-\\(\\)\\.\\; ]*)\\]");
+  // Regular expression to match anything inside [...] that begins in HKEY.
+  // Note that there is a special rule for regular expressions to match a
+  // close square-bracket inside a list delimited by square brackets.
+  // The "[^]]" part of this expression will match any character except
+  // a close square-bracket.  The ']' character must be the first in the
+  // list of characters inside the [^...] block of the expression.
+  cmRegularExpression regEntry("\\[(HKEY[^]]*)\\]");
   
   
   // check for black line or comment
   // check for black line or comment
   while (regEntry.find(source))
   while (regEntry.find(source))