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
20 - Arcturus

@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.