macros: fix stock wildcard-to-regexp function to work with square brackets