Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

RegEx Help - Trim to Specific Character

jeremyblaney
7 - Meteor

I have a field I need to trim, and it looks like RegEx will do the trick. However, I'm having trouble with the syntax. Here's my field info:

 

[FIELD ASSOCIATE ID]

CORP\XKLJFTU

EMEA\JFUIQLF

ASIA\JFITLFQ

LATAM\JTI8RKJK

 

I need to trim the portion in red (CORP, EMEA, etc.) so all I'm left with is the unique identifier following the slash. The portion in red is not a specific number of characters long. It will vary from time to time.

 

Any help would be much appreciated!

2 REPLIES 2
patrick_digan
17 - Castor
17 - Castor

@jeremyblaney I would use a formula tool with this:

REGEX_Replace([FIELD ASSOCIATE ID],".*?\\","")

the . means any character, the * means repeated as many times, the ? makes it "non-greedy" (so that it stops at the first \), and the \\ means find a \ (since \ is a special character, you have to use the \ to escape the special character which happens to be the \ this time).

 

Hope that helps!

jeremyblaney
7 - Meteor

Perfect, thanks! The \\ was throwing me off. I was also able to split this into two columns by using the RegEx tool with this syntax: (.*?\\)(.*)

 

Thanks again!

Labels