Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extract certain words

JosefsS
6 - Meteoroid

Hi Guys,

I have a simple one (At least for a guy in the know).

 

I have the following data in a column (Obviously a lot more combinations)

WLINE11_0070_001
WLINE6_0050_001

 

Can someone help me with the code in Regex to extract only the line/plant ID:

LINE11_0070
LINE6_0050

 

If Regex is not the best solution to this I am happy to take advice on that as well.

 

Thanks in advance,

Soren

8 REPLIES 8
atcodedog05
22 - Nova
22 - Nova

Hi @JosefsS 

Can you provide some sample input and expected output It will help us get a better understanding of the usecase.

We will be happy to help : )

saisaranv
7 - Meteor

if you need only numbers then you can use the formula as ToNumber([String]) like that.

JosefsS
6 - Meteoroid

Hi,

Not 100% sure what you mean by sample input and output over and above what I have given you in the original message.

The data source for this is Excel. 

And the input cell has this information:

WLINE11_0070_001
WLINE6_0050_001

I.e. I need to trim of the "W" at the front and "_001" at the back.

 

The output will be part of a larger flow but I want to create a new column with the new data

saisaranv
7 - Meteor

Trim([Column],"W") AND RightTrim ([Column],"_001") Try this with minor modifications

atcodedog05
22 - Nova
22 - Nova

Hi @JosefsS 

 

Give this a try.

 

Workflow:

atcodedog05_0-1644508702346.png

 

Hope this helps : )

 

OllieClarke
16 - Nebula
16 - Nebula

Hey @JosefsS 

 

RegEx in parse mode

 

W(.+)_\d+

 

will grab everything between a capital W and the final underscore which is followed by numbers

OllieClarke_0-1644508903994.png

 

edit: sorry, forgot to attach the workflow

 

binu_acs
21 - Polaris

@JosefsS 

REGEX_Replace([Input], '\u{1}(.+)\_(.+)', '$1')

binuacs_0-1644510503690.png

 

JosefsS
6 - Meteoroid

Guys,

Lots of good solutions here - thank you all - much appreciated!

Soren

Labels
Top Solution Authors