What is Alteryx RegEx?
Alteryx RegEx, or Regular Expression in Alteryx, is a powerful tool used for pattern matching and text manipulation within the Alteryx Designer platform. It can identify patterns in a string and extract the information from it using the 4 built-in methods: replace, tokenize, parse and match.
4 Methods of Alteryx RegEx
Let’s dive into the four powerful methods offered by Alteryx and learn how it enables you to effortlessly search, manipulate, extract, and filter text patterns within your data workflows.
RegEx Replace: This method enables you to search for a specific pattern within a string and replace it with a desired value. It helps in text manipulation and data cleansing tasks.
RegEx Tokenize: The tokenize method splits a string into multiple parts based on a specified delimiter or pattern. It allows you to extract individual elements or tokens from a larger string.
RegEx Parse: With the parse method, you can extract specific information from a string by defining a pattern with named capture groups. The captured values can then be accessed and used for further processing or analysis.
RegEx Match: The match method checks if a string matches a specific pattern and returns a Boolean value indicating the presence or absence of a match. It is useful for performing conditional operations or filtering based on pattern matches.
How to use RegEx in Alteryx?
- Open the RegEx tool in Alteryx.
- Select the column that you want to parse.
- In the “Format to Convert” section:
- Enter your regular expression. You can use the “+” button to access common regular expressions or refer to the Perl Regular Expression Syntax website for more information.
- By default, the “Case Insensitive” option is selected, meaning that searches will not distinguish between uppercase and lowercase letters.
- In Output, choose from the 4 methods of Alteryx RegEx for parsing.
- Configure the properties related to the selected output method.
- Run the workflow to apply the regular expression operations to your data.
An Alterx RegEx Example
Scenario:
A customer data file contains the address information. We would like to separate the floor and house unit number from the address. We know that the highlighted part of the address is the floor and unit number. How do we dissect this block of text from the address?
Customer ID | Name | Address |
1 | ONG SIAU XIAN | 1 Hougang St 91 #02-08, 538692, Singapore |
2 | RASIDAH BT RAHMAT | 683C WOODLANDS DRIVE 62 05-153, 733683, Singapore |
3 | HAYATI AMID | 135 Jurong East Street 13 #04-331, 600135, Singapore |
4 | CHRISTINA WONG | BLK 133 JALAN BUKIT MERAH, #01-508 160133, Singapore |
Workflow:
Connect the regex tool to the input tool, use the parse method to extract the floor and house unit numbers, and connect the browse tool to view the result.
Step | Tool | Configuration / Result |
1 | Text Input | |
2 | Regex | Use the (….) to mark the block of text we would like to extract, then specify the pattern of this block. In our case, the floor and house number are represented by XX-XXX (2 digits for the floor and 3 digits for the house number separated by ‘-‘ ).
So, we use the expression (\d{2}.\d{3}). \d – means digit You can check the regular expression from the drop-down list of the regex tool. |
3 | Browse | After executing the workflow, there is a new column generated for house no. |
Ready to transform your business with Alteryx? Look no further than equalOne.
If you’re ready to take your data analysis and workflow automation to the next level, Alteryx is your go-to solution. As a trusted partner of Alteryx, we offer tailored Alteryx services to meet your business needs. If you haven’t tried Alteryx before, no worries – it also provides a 30-day free trial for users. Experience the power of Alteryx firsthand and don’t miss out on this opportunity to transform your organization with Alteryx today.