Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

How do I formulate a variable within a string formula?

ccollazo
5 - Atom

I need to create a formula that will identify folder names with a three letter/number identifier as highlighted in red in the example below. What do I type in the quotations for the formula to track this specific pattern? I'm currently trying something along, though I know a wild card would simply grab everything. REGEX_Match([Folder Path], "\xxx\")

 

\\XYZ.com\gac_tower\payroll\General_Airline\A50\2022.09\Journals\2219310\

 

Thank you in advance. 

3 REPLIES 3
DataNath
17 - Castor
17 - Castor

Hey @ccollazo, do you just want to identify a match here i.e. there is a directory with \XXX\? Or do you want to parse it? Have included both options in this workflow - one with the RegEx tool and one just adapting your Regex_Match formula. Hope this helps!

 

Parse (In RegEx tool):

\\([A-Z0-9]{3})\\

 

RegEx_Match (Formula expression):

REGEX_Match([FilePath], ".*\\[A-Z0-9]{3}\\.*")
ccollazo
5 - Atom

That did the trick, thank you @DataNath ! 

 

Just so I understand the logic [A-Z0-9] means any number and/or letter? So I could do something like [C-0-9] if I'm looking for CXX?

 

{3} is just the length of variables I'm allowing correct? So this will only look for 3 variables and something like {5} would look for only 5?

DataNath
17 - Castor
17 - Castor

Great to hear, @ccollazo!

 

So anything you put in square brackets is a group of characters that you're looking for. In my example, the A-Z0-9 represents any letter (A-Z) or number (0-9). If you only wanted C or numbers then it'd just be [C0-9].

 

You're right about the 3 - this tells Alteryx to look for 3 of those characters in the group. Like you say, making this {5} would then tell Alteryx to look for a collection of the characters defined in your group/square brackets that is length 5.

Labels
Top Solution Authors