Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

RegEx Examples - 12 Handy Use Cases

brianprestidge
8 - Asteroid

A lot of data prep questions I get asked about seem to come back to the same answer - "Use Regex!"

 

However, RegEx isn't exactly easy to understand for someone who has never come across it before.

 

This is how I started out, but by dissecting other peoples' uses of RegEx, I started to understand how RegEx works and now I seem to use it in pretty much every workflow I create (slight exaggeration).

 

So I decided to upload the attached workflow that has 12 use cases for RegEx for you to use, adapt, learn from and improve on. Please download the attached Alteryx workflow and explore what's going on and you'll soon be more than comfortable with RegEx too!

 

I've also put some useful RegEx links on the original blog for this workflow here: http://www.theinformationlab.co.uk/2016/10/27/regex-practice-using-alteryx/

 

Feel free to upload your use cases for RegEx on this discussion post, along with examples, and perhaps we can start to create a small repository for everyone - from RegEx newbies to those highly skilled in this complex but extremely useful tool.

15 REPLIES 15
TaraM
Alteryx Alumni (Retired)

Thanks for sharing @brianprestidge! Love me some regex.

Tara McCoy
alex
11 - Bolide

Thanks for sharing!  This beats my RegEx cheat sheet.  Being a total novice to RegEx, this type of workflow example is a great help.  I loved to see if you come up with any other common scenarios that aren't covered in the samples.

Anitta
6 - Meteoroid

Hi Brian

Thank for the regex examples. I have a question for you regarding regexmatch. If i have two columns  A and B containing  some of the sane type of data. A is the data than i want to be matched exactly whereas B can contain redundant data.I want to be able to match and parse out the total numbe of exact matches between the two column using regex. do you have an idea to how to do that?

br anitta 

brianprestidge
8 - Asteroid

Hi Anitta

 

Do you have some sample data you could post up - or if not mock something up that is similar to your example?

 

Thanks

 

Brian

brianprestidge
8 - Asteroid

5 more useful RegEx examples attached based upon common data problems that arise

Screen Shot 2017-01-25 at 10.40.11.png

 

Manjari
8 - Asteroid

Hi @brianprestidge, 

 

Requesting your help on a formula that replaces any string with "1" 

formula giving me an error 

REGEX_Replace([_CurrentField_],($) ,'1')

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

How about:

IIF(IsNull([Field]),Null(),"1")

Keeps null and turns all strings to "1".

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Manjari
8 - Asteroid

@MarqueeCrew

 

Hi Mark,

 

Thanks a ton, this worked like a charm :)

priyanka31
7 - Meteor

Hi,

 

Thank you so much for the real examples. Can you help me to PARSE my FileName column- 

\\ABC-WIN-NAS-P21.ABC.com\GOT_FS\Log_Cost\Contingency\Outputs\COGNOS\COGNOS_Unit_DC.csv

 

I need only COGNOS_Unit_DC from the Filename column

Labels