Move the parsing stage earlier to allow regexp validataion and error checking.

The parsing is done when the Regej is created, allowing the user to check if
the regular expression was correct.
Update the parser code to graciously return on error.

Having the program crash when the parser fails to parse the regular
expression is not acceptable for the user.