Expect the column entries to be strings that can be matched to either any of or all of a list of regular
expect_column_values_to_match_regex_list
This expectation level is PRODUCTION
Contributors:
Tags:
Backend support:#
Description#
Class Name:
ExpectColumnValuesToMatchRegexList
Short Description:
Expect the column entries to be strings that can be matched to either any of or all of a list of regular
Docstring:
Expect the column entries to be strings that can be matched to either any of or all of a list of regular
expressions. Matches can be anywhere in the string.
expect_column_values_to_match_regex_list is a :func:column_map_expectation <great_expectations.execution_engine.execution_engine.MetaExecutionEngine .column_map_expectation>
.
Args:
- column (str): The column name.
- regex_list (list): The list of regular expressions which the column entries should match
Keyword Args:
- match_on= (string): "any" or "all".
Use "any" if the value should match at least one regular expression in the list.
Use "all" if it should match each regular expression in the list. - 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_not_match_regex <great_expectations.execution_engine.execution_engine.ExecutionEngine .expect_column_values_to_not_match_regex>
Renderers#
We have yet to add renderers to this expectation.
Examples#
w | x | column_name with space |
---|---|---|
111 | man | man |
222 | plan | plan |
333 | canal | canal |
123 | panama | panama |
321 | hat | hat |
444 | bat | bat |
456 | bit | bit |
654 | bot | bot |
555 | but | but |
bet | bet |
Tests
basic_positive_test
Input:
column: w,
regex_list: \d+,
}
Output:
success: true,
unexpected_index_list: ,
unexpected_list: ,
}
w | x | column_name with space |
---|---|---|
111 | man | man |
222 | plan | plan |
333 | canal | canal |
123 | panama | panama |
321 | hat | hat |
444 | bat | bat |
456 | bit | bit |
654 | bot | bot |
555 | but | but |
bet | bet |
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