Files
Abseil Team dd0a37b843 Use std::regex (defining GTEST_USES_STD_RE) instead of hand-rolled regex engine (defining GTEST_USES_SIMPLE_RE) in GoogleTest
Previously, non-Abseil builds of GoogleTest used either the POSIX <regex.h> header, or a hand-rolled bare-bones regex engine in GoogleTest.

This commit removes the custom regex engine and switches to the C++11 <regex> header instead, which primarily affects Windows builds. Correspondingly, the GTEST_USES_SIMPLE_RE macro is removed and GTEST_USES_STD_RE is defined in its place, so users that depend on the macro should update their code accordingly.

This commit may break on any exotic toolchains or platforms that lack all of these libraries, but these have been long unsupported, as GoogleTest requires C++17.

Note: MSVC's engine can be prone to overflowing the stack on some patterns and inputs. As a trivial example:

    #include <regex>

    int main() {
      std::string corpus;
      for (size_t i = 0; i < 1000; ++i) {
         corpus += "a\n";
      }
      // Stack overflow
      std::regex_match(corpus, std::regex("(\n|.)*", std::regex_constants::ECMAScript));
    }

In such cases, it is recommended to use alternative patterns accomplishing the same goal, such as checking for pieces of a pattern independently.

PiperOrigin-RevId: 978659894
Change-Id: I4594285e696af12a008e1e4cee300f292bbdbf32
2026-09-09 11:34:13 -07:00
..
2021-06-02 17:55:09 -04:00
2021-05-25 13:34:39 -04:00
2021-02-19 13:55:48 -05:00
2021-02-19 13:55:48 -05:00
2021-02-26 17:58:04 -05:00
2023-06-19 11:21:44 -06:00
2024-12-11 08:00:11 -08:00