Fix bug incorrect regexp for alphanumeric mode, causing corrupted encoding.

Fixes two problem introduced by commit f4f054b8eb121:

Newlines at the end of strings were matched by '^' so
$ echo -ne 'NEWLINE\n' | PYTHONPATH=. python scripts/qr
decoded as "NEWLIND:".

The characters '{' and '}' were allowed, so
$ echo -n '{0}A' | PYTHONPATH=. python scripts/qr
decoded as ":N:X".
Regression test for ALPHA_NUM regex fix

Also a minor speed tweak by compiling the regex rather than rebuilding
it.