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

Parse out user id with RegEx

lahughes
7 - Meteor

I have a column of data that has first name, last name (user_id).  It looks like:

 

lname, fname (c709979)

 

I want to parse out the user_id text into its own column, without the parenthesis.

 

Is RegEx the best way to do this or is there another tool I should use instead?

 

If RegEx, than what would the context look like?

 

Thanks,

Larry

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@lahughes,

 

Create yourself a UserID field with the following formula:

 

REGEX_Replace([Field1], ".*\((\w+)\)", '$1')

Whatever is within the parenthesis will become the userid.  Just change Field1 to your incoming data.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
lahughes
7 - Meteor

Thank you Mark.  That worked perfect.  Appreciate the help.

 

I struggle with the proper syntax of the RegEx tool.  I have used the online help and articles, and understand the overall idea, but when it come to writing the actual statement I can never get it to output what I want.  I guess just more practice and time will help in me understanding the symbols and the structure to use.

 

Thanks,

Larry

MarqueeCrew
20 - Arcturus
20 - Arcturus

@lahughes,

 

For me, it was learning by trial and error.  There is a tool-mastery series (https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689) article and some training that is available.  Initially, I was using TheRegExCoach (http://download.cnet.com/The-Regex-Coach/3000-2056_4-10795049.html) software and have used RegEx101 (https://regex101.com/) to assist me.  It really wasn't until I started trying to help others on the community that I became efficient (not in comparison with @AdamR or @jdunkerley79) in the use of the expressions. 

 

I've thought about having a User Group session focused on the use of Regular Expressions.  I approach the use of RegEx not as a developer, but rather as an analyst in the Line Of Business.  I find a solution path that works for my needs and once functional, I move to the next requirement in the workflow.  As I've learned more, I realize that there are better ways to handle the requirements.  Even in the solution responses to other posts, I can see the artistry of some answers and hope to retain their elegance in my future posts.

 

If you would like to have a WebEx where I can help you (and potentially others) I would be open to helping you.  Please PM me if you are interested and I'll see what we can arrange.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
MarqueeCrew
20 - Arcturus
20 - Arcturus

Larry,

 

P.S.  Here is a screen capture from RegEx101 for the question at hand....

 

Capture.png

Alteryx ACE & Top Community Contributor

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