Use Perl regex with grep to avoid bash weirdness.

It's stupid code either way...
Fixes and long options.