Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Regex Help File name

pvara
8 - Asteroid

Given this file path

I would like the resulting File Name

MO-2019Q2-61958-CLD

 

 

pic.png

 

I understand there is File output using the input tool, however, this is part of an app I am building,

the file input is using a Macro where it is reading multiple tabs and combining them, however part of the requirement for this is app is to have the file name.

 

thank you

3 REPLIES 3
benakesh
12 - Quasar

Hi @pvara ,

Try  FileGetFileName([Field1])    

ex  : input  :   c:\Users\abc\Downloads\SampleData.xlsx    output  : SampleData

 

Regex  for filename :  .*\\(.*).xlsx     

.*  :  any zero or more characters 

\\   :  last  back slash ( regex is greedy by default) 

(.*) : return whatever matches in brackets i.e file name 

.xlsx : match  .(any) followed by xlsx 

pvara
8 - Asteroid

Thank you that worked!

MarqueeCrew
20 - Arcturus
20 - Arcturus
FileGetFileName(Path)

Returns the name portion of the path, without the extension.

Please try this function in your formula. It's easier to maintain than regex.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels