We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer 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

@Ekmi9,

 

Please see below: 

 

messi007_0-1640004466612.png

 

Hope this helps,

Regards,

Kenda
15 - Aurora
15 - Aurora

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
15 - Aurora
15 - Aurora

@Kenda Underscores don't need escaping.

Kenda
15 - Aurora
15 - Aurora

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
19 - Altair
19 - Altair

@Ekmi9 
how about some old school

1220-Ektaoza9.PNG

Labels