Regex Check Rule
Description
The Regex Check rule refers to the use of regular expressions (regex) to validate or enforce specific patterns in data. A Regex Check is essentially a data quality rule or process where regular expressions are used to ensure that data adheres to certain formats or standards.
Rule Configuration
A rule configuration is based on a pattern that occurs when the data being evaluated matches the defined sequence of characters in the pattern. In this context, the pattern is used to ensure that the data adheres to a specific structure or format, such as email addresses, phone numbers, or dates. When the data matches the pattern, it indicates that the rule configuration was successful, meaning the data conforms to the expected format.
- Pattern A pattern refers to a sequence of characters that defines the structure or format you’re trying to match or validate in the data.
Success Criteria
The success criteria for a Regex Check focus on ensuring that data matches the exact structure, contains the appropriate characters, adheres to length constraints, and passes the specific validation rules defined in the regular expression pattern.
-
The success condition depends on how the
Pattern
is given. -
The success condition is met if this count satisfies the given
operator
andvalue
. -
For Sample if RegexCheck pattern is set to validate only phone number and specific symbols then it wont validate data with alphabets.
Configuration Fields
-
Operator Options
Greater than
Less than
Equal to
Between
(requires specifying a start and end range)
-
Operator Defines the comparison operation (Greater Than, Less Than, Equal To, or Between).
-
Value The threshold value used for success criteria. Required for
Greater than
,Less than
, andEqual to
operators. -
Value Range Required only when the
Between
operator is selected, specifying thestart
andend
range. -
Threshold Type Indicates whether the
Value
orValue Range
to be considered as percentage or an absolute count. -
Allow Null Values Determines if null values are permitted.
-
Sample Input
ID | Phone Number | Passwords |
---|---|---|
1 | +8473865435 | Password#1 |
2 | +7835783578 | PASSWORD123 |
3 | a4238957565 | 12345678 |
4 | = 94857457644 | Abc123?! |
5 | +8394757872 | abcd |
Sample Rule Configuration
-
Pattern
^\+?[1-9]\d{1,14}$
(Phone Number) ,^(?=(.*\d))(?=(.*[a-z]))(?=(.*[A-Z]))(?=(.*[#?!])).{8,}$
(Password) -
The Pattern
^\+?[1-9]\d{1,14}$
matches phone numbers that may optionally start with a + symbol for international formats. The number must begin with a non-zero digit and be followed by 1 to 14 additional digits, allowing a total length between 2 and 15 digits. -
The Pattern
^(?=(.*\d))(?=(.*[a-z]))(?=(.*[A-Z]))(?=(.*[#?!])).{8,}$
used for secure passwords must contain at least eight characters, including at least one number, both lowercase and uppercase letters, and at least one special character such as #, ?, or !.
Sample Success Criteria Configuration
- Operator Greater than
- Value 2
- Threshold Type Absolute Count
- Allow Null Values True
Sample Output
Column Name | Rule Name | Success Count | Failure Count | Within Threshold |
---|---|---|---|---|
Phone Number | Phone Number Regex Check | 3 | 2 | Yes |
Passwords | Passwords Regex Check | 2 | 3 | No |