Upgrading Server to version 22.1? We’ve enabled the faster AMP engine by default. Read about how these system settings changes might affect you.

We’re aware of an intermittent issue with our My Alteryx login and are actively working to have the issue corrected. If you run into an error when logging in, please try clearing all cookies or accessing the community on a different browser. Thank you for your patience!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Regex

AS
8 - Asteroid

Hi Experts,

 

Please suggest me regex to pick this number from this text.

 

NameAlteryx Out
12340 - SB - Sub Sub 014912340
23000 - Buy time Vusb Ltd-Vualto BV23000
12345 Earned rsed food sham:56789 Food56789
00000 - My Dep:13400 - Furniture Couch13400
20001 - Traffic Volvd Lab:20005 - Pen Control Water (34k)20005

 

Thanks in advance.

2 REPLIES 2
binuacs
15 - Aurora

@AS 

binuacs_0-1647259339967.png

 

BetterFerret
8 - Asteroid

This simple formula will work
RegEx_Replace([Name],'^.*(\d{5,5}).*$','$1')
Although you did not give exact rules as to which numbers to extract, this pulls the last 5 digit string which applies to the example strings you provided.
The key is keeping the first .* greedy.  This could be refined to only capture 5 digit words by using word breaks \b surrounding the match.