Fix the triplet regexp to recognize triplets, not only quadruplets. This allows triplets where the vendor is not set. patch posted at https://sourceware.org/ml/gdb-patches/2015-03/msg00907.html already applied on the trunk and the 7.9 branch.
See previous comment saying that problem was fixed.
Before the patch the compile command failed with Could not find a compiler matching "^(x86_64|i.86)-[^-]*-linux(-gnu)?-gcc-5$" with the Debian/Ubuntu system compilers, which are configured with a triplet, not having the vendor information as part of the command, e.g. x86_64-linux-gnu-gcc. After the patch, the system compiler is found.