in reply to Match similar words in file name

See my node Building Regex Alternations Dynamically for a short tutorial on this. Also, I see you're using glob, be aware that it has several caveats, for example in this case if $dir happens to have any whitespace or glob metacharacters in it, it will not do what you want. I mention several alternatives in that link.