refactor/simplify wildcard code
Merge pull request #4158 from dmwm/wildcard_cleanup

refactor/simplify wildcard code