pkgdb_get_pattern_query: Fix regex handling when '-' used by not using SPLIT_VERSION

  Error:
    # pkg info -x 'pkg(-devel)?$'
    pkg: sqlite error while executing iterator in file pkgdb.c:1548: Invalid regex

  Expected:
    # pkg info -x 'pkg(-devel)?$'
    pkg-devel-1.3.0.b2

Partial revert from fa815ff62