fix g++ versions support

when compiling a c++ project (mesos) with a homebrew gcc-4.6, gcc was used instead of g++, which led to symbol not found errors. by fixing regexp to allow optional version string in executable name, we ensure that g++ of the right version is used