community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Regex Help File name

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

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 

Asteroid

Thank you that worked!

Alteryx Certified Partner
Alteryx Certified Partner
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 reboot. Order shall return.
Labels