Fix the parser for regexen and add CantHappen exception
Add tests for the regex parser
Use CantHappen exception where appropriate