google/benchmark — pull request #41 by mattyclarkson (2014-07-30 18:27:23+00:00)
Title: C++11 Regular Expressions

I would like to get `benchmark` working on Windows. I see that #29 has done a lot of work in that respect but resulted in #30 about the replacement of the `Regex` class with `std::regex`.

This PR implements a C++11 backend to the `Regex` class that passes the unit tests. This is more to start a discussion of how to proceed with this branch.

From what I can see `Regex` is only used in [one place in `benchmark.cc`](https://github.com/google/benchmark/blob/890908c1976ec733125c28c70e1d1de5aa5a7447/src/benchmark.cc#L370) so the `Regex` class could be dropped all together. However this is opposed by @dominichamon

> i actually had some issues when i tried using std::regex for this project as the matching wasn't quite the same. I don't remember the details, i'm afraid, but i'd want much more testing before making this change.

So I need to make the unit tests __much__ more thorough than [what they are now](https://github.com/google/benchmark/blob/890908c1976ec733125c28c70e1d1de5aa5a7447/test/re_test.cc#L18). I'm not sure what strings I should be testing to make sure that the C++11 backend is actually doing the same thing (it uses the same `extended` matching flags).

There are other issues here, whilst `__cplusplus >= 201103L` is the correct check to work out if we are in C++11 mode `gcc` `4.7` and `4.8` don't actually have `` it only came in [`4.9`](https://gcc.gnu.org/gcc-4.9/changes.html). So switching to just using `std::regex` would result in dropping support for anything before `4.9`. So a _much better check_ would be for CMake to compile a snippet to work out if we have regular expressions and fallback to POSIX regular expressions as neccessary.

Soooooo, where shall we go from here? I'm happy to put in as much effort as needed until `benchmark` builds from CMake for MinGW. VS should drop out nicely from this as CMake is awesome...but MSVC is crap so who knows what will happen there. Maybe [`clang`](http://llvm.org/builds/) to the rescue :wink: