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

Remove leading characters using multi field formula

Avatar
5 - Atom

Hello, i have multiple columns with strings prefixed by numerics and zpecial characters

 

17;#Tim, kan
347;#Low, Jim

24;# Sou,Xi

I want the out put as 

Tim, kan

Low, Jim

Sou,Xi

3 REPLIES 3
Kenda
16 - Nebula
16 - Nebula

Hey @Avatar!

 

Will your field always have a hashtag before the part you want to keep? If so, the following code will work:

REGEX_Replace([Field1], "(.*\#\s?)(\u.*)", "$2")

avatar.PNG

 

 

Otherwise, a more diverse approach may be with this:

REGEX_Replace([Field1], "(\d+\W+\s?)(\u.*)", "$2")

avatar2.PNG

Avatar
5 - Atom

Hi Quasar,

Works perfectly .. Thank you so much!!!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Avatar,

 

I am glad to see that @Kenda has helped you to solve your challenge.  I do want to add another option to the post in case others may come across this in the future.  My friend @LordNeilLord often asks me about alternatives and their performance.  While I like the formula tool for parsing because of a variety of preferences, this case made me want to use the RegEx tool directly.

 

capture.png

 

In looking at your pattern, I saw the following:

  • Stuff I wasn't interested in
  • Stuff that I was interested in
    • This stuff always had a comma preceded by a name
      • A name always has word characters preceded by a non-word character

What I really saw was a group of 1 or more word characters followed by a comma including anything else.

(\w+,.*)

When I put this into the above pictured tool, the configuration I thought was simple and my expression was less complex than the formula.  This solution is 50% more efficient (timed with 3,000,000 rows of data) than the formula technique in terms of time spent processing.

 

I've included the workflow here for you.  To test the comparison of results, disable one container and run.  Then repeat.  Then switch enable/disable and repeat tests.

 

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels