Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

RegEx Parsing Help

mina_ran
8 - Asteroid

Hi,

 

I am trying to use the RegEx tool to parse data. This is my first time using RegEx, so naturally, everything looks alien to me here. I have a dataset with a column I would like to separate into three columns; a name, a capital letter, and a number. The data currently looks like this:

 

Annie,F,1258

 

I read an introduction post to parsing with RegEx, so I get the basics, but I can't figure out why the expression I have included won't parse the way I want it to. At first, I only included an expression to parse out the name: which worked perfectly! Then, I added an expression to parse out the capital letter after the name as well, and now I am only seeing null values. See picture below. Any ideas as to how I should formulate my expression? 

 

regex1.pngregex2.png

3 REPLIES 3
Ladarthure
14 - Magnetar
14 - Magnetar

There are 2 solutions about that, the first using text to colums (easy one) and another with regex (could be optimized I guess)

kat
12 - Quasar

Hi @mina_ran

 

The easiest way here is definitely text to columns, like @Ladarthure had, as you have comma separating your data points.

 

I thought I'd just give you a quick idea of how the regex works though, for your understanding.

regex2.PNG

 

  • Each item in brackets is a separate bit of data to spit out - since we have three sets of brackets we get three outputs.
  • \w is a letter. The + means more than 1. so you're saying give me more than one letter
  • we then show that there will be a comma. This is outside the brackets as we don't want to return it
  • the \u is an uppercase letter. You need to uncheck case insensitive for this to have any impact
  • same thing with the comma
  • the \d is a number. The plus again shows that we want more than one.
  • there's loads of different ways of doing this! :)

Hope this gives you a little bit of an idea. The best place to practice regex is www.regex101.com . This will highlight your text as your going showing exactly what each part of your code is doing. I use it all the time.

 

mina_ran
8 - Asteroid

Thank you @Ladarthure and @kat for your help! Looks like i forgot to add a , between the expressions and that's why I only got null values. All good now :) 

Labels