diff --git a/libmexclass/cpp/CMakeLists.txt b/libmexclass/cpp/CMakeLists.txt
index 5e44d5e..904a65c 100644
--- a/libmexclass/cpp/CMakeLists.txt
+++ b/libmexclass/cpp/CMakeLists.txt
@@ -113,9 +113,9 @@ macro(MatlabConfigure)
message(STATUS "File content:")
message(STATUS "${VERSION_INFO_TEXT}")
- string(REGEX MATCH "[.]+" STRING_MATCH ${VERSION_INFO_TEXT})
+ string(REGEX MATCH "[\S]+<\/version>" STRING_MATCH ${VERSION_INFO_TEXT})
message(STATUS "STRING_MATCH = ${STRING_MATCH}")
-
+
if (NOT DEFINED MATLAB_RELEASE_VERSION)
# Temporarily require users to supply MATLAB_RELEASE_VERSION if
# find_package(Matlab) fails to derive the version from the root