Hi all!

I've produced a patch that should fix this issue. As brought up in this Emacs.SE answer, the main challenge was distinguishing the qualifiers from subshells. To do this, I disallowed leading octothorpes wrapped in parentheses where the parentheses are not separated from other tokens by metacharacters. For qualifiers (which appear after a glob), the fix is trivial. For flags (which appear before the glob), I have to rely on the fact that flags may not contain parentheses themselves to avoid needing more sophisticated parsing.

I've tested this against a fairly comprehensive test file, which I've also attached.

Thanks,
Jonathan