Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

New to Regex Tool. Need assistance with extracting data from a string.

us475279
6 - Meteoroid

Hi everyone, 

 

Thanks for taking a look at my scenario:

 

I am trying to extract a numeric account number that can be various digits in length from a Description column that has multiple consolidated values and the account number does not appear at the same position within the text.  To make matters more complicated, each of the descriptions can contain various terminology to indicate the account number.  In some cases, "account" will precede the number, other times "to" or "from" precedes the account number. It can vary widely across the text.   

 

Is there a way to utilize the Regex tool in order to extract the numeric account string?   I've attached a scrubbed list of examples with a tab that includes the values illustrating the desired results.  

 

Thanks in advance for your help! 

HG

8 REPLIES 8
Felipe_Ribeir0
16 - Nebula

Hi @us475279 

 

Try this formula:

REGEX_Replace([Description], '(.*?)(0{1,}[1-9]{1,})(.*)', '$2')

regex111.png

 

Dina
9 - Comet

Just another way.

Screenshot 2023-08-08 133357.png

 

flying008
14 - Magnetar

Hi, @us475279 

 

FYI.

 

^.+?(?<=[[:alpha:]]\s)(\d+)

 

录制_2023_08_09_09_30_03_19.gif

us475279
6 - Meteoroid

Thank you Felipe! 

us475279
6 - Meteoroid

Thank you Dina!

us475279
6 - Meteoroid

Thank you Flying 008!

flying008
14 - Magnetar

Hi, @us475279 

 

If can help you get your want, please mark it as s solution for more share. 

caltang
17 - Castor
17 - Castor

Yes, @us475279 - kindly mark @Felipe_Ribeir0 @Dina @flying008 's solutions as accepted solutions so that we can close the thread and it helps others identify the solution faster.

 

Thanks!

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels