Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
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