Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, "[at]+" would identify the following strings as expected: "fish", "dog", and the following as unexpected: "cat", "hat".
expect_column_values_to_not_match_regex
This expectation level is PRODUCTION
Contributors:
Tags:
Backend support:#
Description#
Class Name:
ExpectColumnValuesToNotMatchRegex
Short Description:
Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, "[at]+" would identify the following strings as expected: "fish", "dog", and the following as unexpected: "cat", "hat".
Docstring:
Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, "[at]+" would identify the following strings as expected: "fish", "dog", and the following as unexpected: "cat", "hat".
expect_column_values_to_not_match_regex is a :func:column_map_expectation <great_expectations.execution_engine.execution_engine.MetaExecutionEngine .column_map_expectation>
.
Args:
- column (str): The column name.
- regex (str): The regular expression the column entries should NOT match.
Keyword Args:
- mostly (None or a float between 0 and 1): Return
"success": True
if at least mostly fraction of values match the expectation. For more detail, see :ref:mostly
.
Other Parameters:
- result_format (str or None): Which output mode to use:
BOOLEAN_ONLY
,BASIC
,COMPLETE
, orSUMMARY
.
For more detail, see :ref:result_format <result_format>
. - include_config (boolean): If True, then include the expectation config as part of the result object. For more detail, see :ref:
include_config
. - catch_exceptions (boolean or None): If True, then catch exceptions and include them as part of the result object. For more detail, see :ref:
catch_exceptions
. - meta (dict or None): A JSON-serializable dictionary (nesting allowed) that will be included in the output without modification. For more detail, see :ref:
meta
.
Returns:
An ExpectationSuiteValidationResult
Exact fields vary depending on the values passed to :ref:result_format <result_format>
and
:ref:include_config
, :ref:catch_exceptions
, and :ref:meta
.
See Also:
- :func:
expect_column_values_to_match_regex <great_expectations.execution_engine.execution_engine.ExecutionEngine.expect_column_values_to_match_regex>
:func:expect_column_values_to_match_regex_list <great_expectations.execution_engine.execution_engine.ExecutionEngine .expect_column_values_to_match_regex_list>
Renderers#
We have yet to add renderers to this expectation.
Examples#
a | b | c |
---|---|---|
aaa | aaa | |
abb | abb | |
acc | acc | |
add | bdd | |
bee |
Tests
negative_test_insufficient_mostly_and_one_non_matching_value
Input:
column: a,
regex: ^a,
mostly: 0.3,
}
Output:
success: false,
unexpected_index_list: 0,1,2,3,
unexpected_list: aaa,abb,acc,add,
}
a | b | c |
---|---|---|
aaa | aaa | |
abb | abb | |
acc | acc | |
add | bdd | |
bee |
Want to make your own Expectation or an improvement to this one?
We've put together some great how to guides (including videos) on how to create your own expectations in a flash!
You can see those resources here: Contributor Resources