Alteryx Designer Desktop Discussions

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

Regex for Finding Specific Character

EmilioB
7 - Meteor

Hello team,

 

Once again I'm trying to write down a Regex formula. The situation is that I have several records in one column and I want to to add a column with a small description of the code:

 

Column 1 Column 2

M1258     M Code

S2859

 

I managed to get "M Code" but in all my records in Column 1, and I don't know how to indicate that the first character must be a "M".  I want to discard all no M Code.

 

My regex is : REGEX_Replace([Column 1],"(\u).*",'M Code',0).

 

I hope you can provide me some guidance.

 

Thank you!

2 REPLIES 2
dlopez
8 - Asteroid

Hi @EmilioB,

 

Not sure if in column 1 if the "M" will always be the first character, but if that's the case a simple left() function can isolate the M then you can create your "Column 2" from that. Below is a quick outline of the solution.  If you could share more examples of the values in column 1, we should be able to better understand the issue better. 

dlopez_0-1595958114147.png

 

EmilioB
7 - Meteor

Thank you,

 

It worked. Nevertheless, I would like to know how to express it using Regex.

Labels