As far as I'm aware, rm -f !(text.txt) isn't enabled by default, at least in bash. You have to enable extended globbing by running 'shopt -s extglob' first (or add it to your profile).
Great feature though, it adds a ton of extra pattern matching. Not (!) is definitely my most used though.