transformations:regexp
This is an old revision of the document!
Regular expression
This action creates a column with values that match a pattern specified using a regular expression.
Modes
- First match only - for each value find only it's first match (if any). Ignore other matches.
- All matches - for each value find all possible matches. If there is more than 1 match then insert additional row(s) into the resulting dataset.
Example
Table: Before
Phone number |
---|
1234567890 |
(123)456-7890 |
123-4567890 |
123-456-7890 |
(123)4567890 |
Goal: find phone numbers that match pattern (XXX)XXX-XXXX
where X is any number.
Solution: Use regular expression ^\(\d{3}\)\d{3}-\d{4}
. If not matched make empty.
Table: After
Phone number | Matches |
---|---|
1234567890 | |
(123)456-7890 | (123)456-7890 |
123-4567890 | |
123-456-7890 | |
(123)4567890 |
transformations/regexp.1534359552.txt.gz · Last modified: 2018/08/15 14:59 by dmitry