You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to run 'expect_values_to_match_regex' rule, but the result has errors that look like this:
Invalid regular expression: '[Aa-Zz]', invalid character class range: a-Z\n[SQL: SELECT first AS unexpected_values \nFROM ge_temp_de90d2b5 \nWHERE first IS NOT NULL AND NOT (first RLIKE %(param_1)s)\n LIMIT %(param_2)s]\n[parameters: {'param_1': '[Aa-Zz]', 'param_2': 20}]\n(Background on this error at: https://sqlalche.me/e/14/f405)\n"/n%22),
regex used: '[Aa-Zz]'
I actually need the regex to check for SSN. The one I'm using is -
'^(?!666|000|9\\\\d{2})\\\\d{3}-(?!00)\\\\d{2}-(?!0{4})\\\\d{4}$'
But this also show error:
Invalid regular expression: '^(?!666|000|9\\d{2})\\d{3}-(?!00)\\d{2}-(?!0{4})\\d{4}$', no argument for repetition operator: ?\n[SQL: SELECT sum(CASE WHEN (ssn IS NOT NULL AND NOT (ssn RLIKE %(param_1)s)) THEN %(param_2)s ELSE %(param_3)s END) AS "column_values.match_regex.unexpected_count", sum(CASE WHEN (ssn IS NULL) THEN %(param_4)s ELSE %(param_5)s END) AS "column_values.nonnull.unexpected_count" \nFROM ge_temp_4b471582]\n[parameters: {'param_1': '^(?!666|000|9\\\\d{2})\\\\d{3}-(?!00)\\\\d{2}-(?!0{4})\\\\d{4}$', 'param_2': 1, 'param_3': 0, 'param_4': 1, 'param_5': 0}] Rule used:
{"expectation_type": "expect_column_values_to_match_regex", "kwargs": {"column": "ssn", "regex": "^(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$"}, "meta": {}, "quality_dimension": "Completeness"}
NOTE: Table is in Snowflake
So basically, all regex are throwing errors for me. What's the solution? Am I doing something wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm trying to run 'expect_values_to_match_regex' rule, but the result has errors that look like this:
Invalid regular expression: '[Aa-Zz]', invalid character class range: a-Z\n[SQL: SELECT first AS unexpected_values \nFROM ge_temp_de90d2b5 \nWHERE first IS NOT NULL AND NOT (first RLIKE %(param_1)s)\n LIMIT %(param_2)s]\n[parameters: {'param_1': '[Aa-Zz]', 'param_2': 20}]\n(Background on this error at: https://sqlalche.me/e/14/f405)\n"/n%22),
regex used: '[Aa-Zz]'
I actually need the regex to check for SSN. The one I'm using is -
'^(?!666|000|9\\\\d{2})\\\\d{3}-(?!00)\\\\d{2}-(?!0{4})\\\\d{4}$'
But this also show error:
Invalid regular expression: '^(?!666|000|9\\d{2})\\d{3}-(?!00)\\d{2}-(?!0{4})\\d{4}$', no argument for repetition operator: ?\n[SQL: SELECT sum(CASE WHEN (ssn IS NOT NULL AND NOT (ssn RLIKE %(param_1)s)) THEN %(param_2)s ELSE %(param_3)s END) AS "column_values.match_regex.unexpected_count", sum(CASE WHEN (ssn IS NULL) THEN %(param_4)s ELSE %(param_5)s END) AS "column_values.nonnull.unexpected_count" \nFROM ge_temp_4b471582]\n[parameters: {'param_1': '^(?!666|000|9\\\\d{2})\\\\d{3}-(?!00)\\\\d{2}-(?!0{4})\\\\d{4}$', 'param_2': 1, 'param_3': 0, 'param_4': 1, 'param_5': 0}]
Rule used:
{"expectation_type": "expect_column_values_to_match_regex", "kwargs": {"column": "ssn", "regex": "^(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$"}, "meta": {}, "quality_dimension": "Completeness"}
NOTE: Table is in Snowflake
So basically, all regex are throwing errors for me. What's the solution? Am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions