Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Extracting specific part of the string

Chirag_KRCPL
8 - Asteroid

The data is as follows (here the date is in string datatype):

 

31/December/2022

31/Dec/2022

December/31/2022

Dec/31/2022

 

Requirement - I want to extract the name of the month from this string using regex and want to count the length of the resultant string.

 

Kindly help me with the solution.

 

Regards,

Chirag 

2 REPLIES 2
DataNath
17 - Castor

@Chirag_KRCPL how does something like this look? The first expression just replaces all non-letters with nothing to strip out numbers/punctuation. The second expression then brings back the length of this resulting extract:

 

DataNath_0-1663926278091.png

IraWatt
17 - Castor
17 - Castor

Hey @Chirag_KRCPL,

Here is one way of doing this:

IraWatt_0-1663926259167.png

I use the regex tool with the pattern:

([[:alpha:]]+)

This extracts just the months with your sample data set.

Then I use the length function to get the length of the strings.

 

If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

 

Labels