|
A pattern is a combination of abstracted character sets and literal characters that can summarize data patterns in a column. Patterns can be applied through one of two methods:
are pattern-matching widgets that provide a layer of abstraction on top of regular expressions. Instead of having to specify the sometimes complex underlying regular expression, you can specify a simple token to represent the underlying expression.
Tip: While regular expressions are a widely used standard, |
This section provides an overview of the pattern matching features of the platform.
Within a row, multiple patterns may be applied at different levels of abstraction to describe the data in all fields (columns) of the row. Suppose you have two records like the following:
[cz.laping@gmail.com,3987,1446319063821] [ajuneauk@gmail.com,5289,1447275151508] |
The above records can be described by any of the following patterns:
[{alpha-numeric}+,{4-digits},{13-digits}] [{email},{4-digits},{13-digits}] [{alpha-numeric}+@gmail.com,{4-digits},{13-digits}] |
NOTE: The above patterns utilize the syntax of |
In the above case, all three pattern sets capture the data completely. However, please note the differences between the patterns for column 1:
Pattern | Description |
---|---|
{alpha-numeric}+ | This pattern captures alpha-numeric values of one or more characters. So, entries that match on this pattern do not need to be valid email addresses. |
{email} | This pattern ensures matching only on valid email addresses. So, values that do not match this pattern are likely to be flagged as mismatched within the platform. |
{alpha-numeric}+@gmail.com | This partial pattern ensures that the only matches are from gmail.com. |
Depending on the specific meaning of the data for your use, any of the above may apply.
Pattern matching applied to columns can permit users to see the most common patterns and anomalous patterns of data in a column across the entire sample. Since patterns presented to the user encompass the entire set of values in the sample, you can gather detailed information about the consistency of data in the column across the column.
Tip: Column pattern profiling is especially useful after you have addressed the mismatched values in the column. |
Based on the patterns surfaced for the column, you can take any of the following actions:
Additionally, collects aggregated information about patterns applied by all users. These patterns are given weight in the set of suggested patterns presented to each user.
As part of pattern matching, the platform evaluates the data against the specified data type for the column. Type-specific pattern matching applies to the following data types:
See Standardize Using Patterns.
In the application, patterns can be used as the starting point in building your next recipe step, and you can modify or iterate on a pattern definition to preview the results of the specified transformation. Patterns are used in the following actions:
When you select a value in the data grid, your options include pattern-based suggestions. In this manner, you indicate something of interest and enable the platform to interpret your specific interest or broader goal for the selected data. These broader changes are surfaced as pattern-based suggestions in the context panel.
In the Column Details panel, you can review sets of patterns that describe subsets of the values in the column. When you select one of the patterns, you are prompted with a set of suggested transform steps to apply to the data. See Column Details Panel.
In addition to the above basic uses, patterns can be used as the basis for the following advanced uses and more.
Use | Description |
---|---|
Standardize records | Match values based on a pattern and then change values to fit this pattern. See Standardize Using Patterns. |
Filter records | Keep or delete records based on patterns of values found in row data. See Filter Data. |
Extract values | Extract values matching a pattern from one column and insert them into a new column of data. See Extract Values. |
Generate function outputs | Use patterns to generate function outputs in new columns. |
In your recipe steps, you can specify patterns using either of the following methods.
Regular expressions (regexes) are sequence of characters that can be used to define a pattern. This pattern can be used in the transformations that support regex to identify patterns in your data of interest to you. Example:
replace col: myCol with:/$1/ on:/^\((\d\d\d)\)/ global: false |
In the above step, the matching pattern expressed in the on
clause evaluates in the following manner:
^
indicates the start of the value in the myCol
column. So, the matching is only made at the beginning of the column.\(
and \)
are representations in regular expressions of the literal values for parentheses. So, matches are made on those specific characters.So, the net effect is to search the beginning of a field for values like (555)
and replace them with just the digits: 555
. This replacement removes the parentheses from the area code part of a phone number.
NOTE: Regular expressions are very powerful tools for matching patterns. They can also cause unexpected results. Use of regular expressions is considered a developer-level skill. You should use the |
implements a version of regular expressions based off of RE2 and PCRE regular expressions.
Use to quickly assemble sophisticated patterns to match in your data. The following example includes the equivalent
as the previous regular expression:
replace col: myCol with:`$1` on:`^\(({digit}{3})\)` global: false |
For more information, see Text Matching.