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

String manipulation

Ekmi9
8 - Asteroid

I wanted to trim below mention string and get "20470' this number.

 

input: 915255245_4004_20470_7307.xlsx

output:20470

 

note: length of the number is different case by case.

5 REPLIES 5
messi007
15 - Aurora
15 - Aurora

@Ekmi9,

 

Please see below: 

 

messi007_0-1640004466612.png

 

Hope this helps,

Regards,

Kenda
16 - Nebula
16 - Nebula

Hi @Ekmi9 

 

 

This is the perfect case for RegEx! Here is an expression that should work in a formula tool: 

REGEX_Replace([Field1], "\d+\_\d+\_(\d+)\_\d+.xlsx", "$1")

 

This is telling Alteryx that there are 4 groups of digits separated by the _ symbol and you want to keep the third grouping (the one with parenthesis in your expression).

 

Hope this helps!

PhilipMannering
16 - Nebula
16 - Nebula

@Kenda Underscores don't need escaping.

Kenda
16 - Nebula
16 - Nebula

I was wondering @PhilipMannering, but included them anyway to be safe. Thanks!

 

I just ran it without them and it still works like a charm. @Ekmi9 this is the new expression:

REGEX_Replace([Field1], "\d+_\d+_(\d+)_\d+.xlsx", "$1")

 

Qiu
21 - Polaris
21 - Polaris

@Ekmi9 
how about some old school

1220-Ektaoza9.PNG

Labels
Top Solution Authors