Fix error where similar database names cause connection check to fail falsely.

Grep whole-word search breaks on hyphens, so if the databases being
matched against have hyphens, with the same base (desireddb, desireddb-2)
then it would match on multiple. The subsequent check for equality
of output to the name of the desired database fails. This changes
from whole-word to proper regex implementation.