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.
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!
@Ekmi9,
Please see below:
Hope this helps,
Regards,
@Kenda Underscores don't need escaping.
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")
@Ekmi9 how about some old school