Alteryx Designer Desktop Discussions

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

Extract dates from a text string

crownhang
5 - Atom

Hi, I am new to Alteryx and I'm trying to parse out the date information out of a string of text. 

 

The text is written as follows ABC_DEF_GHI_JKL_MNO_202210189999. I am trying to use the first 8 digits in the last word of the text string to get month information. Any suggestions are appreciated! Thank you. 

3 REPLIES 3
acarter881
12 - Quasar

Hello @crownhang.

 

Here's one method, using a Formula tool. I've attached the workflow. The formula can be edited to be more robust; this is just an example. Please let me know if you need an explanation or further editing.

Spoiler
acarter881_0-1666124488059.png

 

 

crownhang
5 - Atom

Thank you!!! It works. Would you mind explaining ".*_(2021\d{4}).*", "$1" in the formula? Appreciate it. 

binuacs
20 - Arcturus

@crownhang One way of doing this

 

DateTimeFormat(DateTimeParse(REGEX_Replace([Field], '.*_(\d{8}).+', '$1'),'%Y%m%d'),'%B')

 

REGEX_Replace([Field], '.*_(\d{8}).+', '$1') - 

 

binuacs_1-1666127385961.png

 

 

Labels