Alteryx Designer Desktop Discussions

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

RegEx

rajputakansha
8 - Asteroid

Hello everyone,

 

I am trying to use RegEx to extract month(10,11,12) from file names. The file names are in the below format-

 

10 October 2022.xlsx

11 November 2022.xlsx

12 December 2022.xlsx

 

I need to extract month from the file path string, which looks like this-

 

D:\Shared\Data\12 December 2022.xlsx|`Sheet1$

 

Is there a simple way to achieve it?

 

Thanks in advance!

5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@rajputakansha ,

 

If the data is as you describe, then I'd first use

FileGetFileName(FullPath): Returns the name portion of the path, without the

 

That gives you 12 December 2022

 

Then use:

 

DateTimeParse([datafromabove],"%d %B %Y)

see:  https://help.alteryx.com/20223/designer/datetime-functions

 

That gives you:

 

2022-12-12

 

Things should be doable now.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
RobertOdera
13 - Pulsar

Hi, @rajputakansha 

 

This is brute force, and I hope you will get more elegant treatments.

There are two approaches based on the patterns I see in your file path (use spaces or text).

 

Please wait to mark it as an acceptable solution until better treatments are offered, but it should work for you.

Cheers!

 

RegExForRajputakansha.PNG

rajputakansha
8 - Asteroid

works great! Thank you so much!

RobertOdera
13 - Pulsar

You're most welcome @rajputakansha 

matthewbechard
8 - Asteroid

Regex isn't always the easiest simplest solution.  Wouldn't just a text to columns do the trick?

2023-01-13_16-39-56.png

Labels