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

Regular expression requirement

rnayan
7 - Meteor

I am struggling with one requirement where I need to extract a specific string, but I'm unable to get it.

Please help..

 

String is:

 

/availability/documents/myfilenamev10.xlsx"targetnew

 

From above string i want to extract myfilenamev10.xlsx 

 

Regards,

Rajeev Nayan

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor
Hi,

Try REGEX_Replace ([Field1], '.*/(.*?)"', "$1")

Cheers,
MarqueeCrew
20 - Arcturus
20 - Arcturus
Did you know that there are file functions?

FileGetFileName(Path): Returns the name portion of the path, without the extension.

OpenExample
FileGetName(C:\Temp\Data\file.csv) returns "file"

FileGetName(C:\Temp\Data) returns "Data"

Try:

Regex_replace([field],".*\/(.*)\".*",'$1')

It just might work too.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
rnayan
7 - Meteor

Thanks Mark,

 

But Filegetname might not work in this case, because i am extracting this filename from a html response.

 

Also, the regular expression you provided does not work. It has syntactical error. Please see the screenshot below.

 

regex.JPG

Thableaus
17 - Castor
17 - Castor
Hi,

Try REGEX_Replace ([Field1], '.*/(.*?)".*', "$1")

Cheers,
rnayan
7 - Meteor

This worked. Thanks alot :)

 

Cheers,

Rajeev

Labels