pkg query -g: Fix handling of character ranges such as 'name-[0-9]*'

This broke CONFLICTS handling in many ports.

Similar to 8ccfa88c4
Reported by:	hrs