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

Regex to extract .yxmd filenames

MartWClimber
9 - Comet

I've got a workflow output that output's full path's combined with some extra data in 1 line.

 

 

//server/filelocation\workflowfilename.yxmd - randomnumbers \csv_input.csv

 

I'm trying to use some regex to extract the .yxmd part of this long string but i'm getting stuck on this.

the workflow names are some what different but the string always are build up with 

 

filelocation\workflowname.yxmd -

 

The easy part is to extract filenames that don't have the same name as the folder there are placed in and let regex start at the / character.

But some of the workflow names are the same as some folder names.

like //server/01Sales\01Sales.yxmd - extra data.

 

is there a way to only extract the 01Sales.yxmd with regex?

 

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @MartWClimber 

 

Here is how you can do it.

Workflow:

atcodedog05_1-1643099695900.png

 

Hope this helps : )

 

AngelosPachis
16 - Nebula

Hi @MartWClimber ,

 

Maybe you can try the following expression in a RegEx tool?

 

\\(.+\.yxmd)

 

AngelosPachis_0-1643099487418.png

 

Thanks,

Angelos

PhilipMannering
16 - Nebula
16 - Nebula

Some filenames can contain periods/fullstops. I would use,

REGEX_Replace([Field1], '.*\\(.*\.yxmd).*', '$1')

 

Or if you can't anticipate whether you have forward slashes or backslashes,

REGEX_Replace([Field1], '.*[/\\](.*\.yxmd).*', '$1')

 

 

binuacs
20 - Arcturus

@MartWClimber 

 

.*\\(.+\.yxmd)

binuacs_0-1643101447261.png

 

MartWClimber
9 - Comet

had to mod the answers a bit but it works now. some of the workflow filenames had some more stuff attached like  server\folder\/subfolder/workflow.yxmd - etc or server\folder\/subfolder/subfolder/workflow.yxmd.

so after the regex I used a text to column and formula tool to get rid of the subfolders. works great thanks you all

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @MartWClimber 

Cheers and have a nice day!

Labels