Alteryx Designer Desktop Discussions

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

Extract Number from a String

lac
7 - Meteor

Hello, 

Can someone please help? I'm trying to extract numbers from a field that are followed by the letters CY.

 

so in this example i only want to extract the numbers 2020 from the string below. This number will change but will always be followed by CY or cy

 

U9898 Happy go lucky until 2020CY or until today 321
3 REPLIES 3
Luke_C
17 - Castor

Hi @lac 

 

Here's 2 ways, one regex, one text parsing:

 

Regex:  .*(\d{4})CY.*

Formula: tonumber(substring([Field1],findstring(UPPERCASE([Field1]),'CY')-4,4))

Luke_C_0-1647880408073.png

 

 

binuacs
20 - Arcturus

@lac 

binuacs_0-1647880673119.png

 

lac
7 - Meteor

Thank you this was super helpful

 

Labels