This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
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.
Solved! Go to Solution.
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!
@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