We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to match string with wildcard (*)

hcho
8 - Asteroid

I currently have a workflow that ensures a field matches one of the specified classification categories (referred to as "Classes") and flags those that do not exactly match the selected categories.

 

For example, my requirements file requests that all "Occupations" other than "Doctor" and "Software" be returned:

FileNameFieldTypeClassesEmptyOK
CustomerOccupationClassDoctor,SoftwareFALSE

 

In my original data file, the bolded entries are currently returned as follows:

RecordIDOccupationFirstNameLastNameAgeYearsOfEducationYearsAtCurrentJobSalary
1DoctorRonaldDryer4316583000
2 AngelinaPrissant3318487000
3Doctor/DentistTaraJackson2812635000
4Doctor/OncologistKeithJacobs5614863000
5Doctor/PediatricianTerrenceMcKinley2618280000
6Doctor/DematologistWilmaHolmes63161277000
7DoctorMarkHodges4612234500
8Doctor/NeurologistDanielleRodriguez29221108000
9SoftwareMichaelLawrence5316793000
10SoftwareMichaelLawrence53167930
11SoftwareChristinaKim3216488000
12UnemployedChristinaLi3216488000

 

This is working as expected. However, if the requirement classes are inputted as "Doctor*,Software" with a wildcard, I want all occupations starting with "Doctor" to be considered valid, resulting in the following output:

FileNameRecordIDOccupationFirstNameLastNameAgeYearsOfEducationYearsAtCurrentJobSalaryInvalidField
Customer2[Null]AngelinaPrissant3318487000Occupation
Customer12UnemployedChristinaLi3216488000Occupation

 

How can I modify my workflow to support this wildcard option? I want to ensure that the existing functionality without wildcards remains unchanged.

I've attached my current workflow for reference.

5 REPLIES 5
shancmiralles
11 - Bolide

hi! can't we do a text to row for the occupation column of your input data like what you did with the R input? tysm 

hcho
8 - Asteroid

Can you expand more??

shancmiralles
11 - Bolide

You use a text to column tool on the workflow you uploaded for your R Input ..
can't you do the same thing for your data (also split to rows)? 
then join them with the occupation column and class column? 
thanks!

hcho
8 - Asteroid

I'm trying to use a wildcard because the delimiter may not always be "/". If "doctor" appears in both columns, I'd like to capture those records in the third join (J) anchor.

Can regex be used in the Join tool to achieve this?

shancmiralles
11 - Bolide

hi @hcho 

you have to make your wildcard not a wildcard..... 

try using this formula:
REGEX_Replace([Classes], "[^a-zA-Z0-9 .-]", '/')

so, what this does.. your wildcard delimiter which is not a letter or a number  - is changed to "/". then you can parse it in a normal way  (text to column by row).. 
one of my mentors @Billd34  gave me the idea ... (which he got from  https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Regex-Special-Characters/td-p/...  ) 

i do hope this helps!
enjoy working on your WF! 😊
  

Labels
Top Solution Authors