Fix regex format validation and fix the regex format unit tests.