Hi,
I am trying to use Regex replace function to extract simply the file name from the complete output path as below.
Input Field | Output Field |
\\mysharedrive.sharedrive.com\Folder1\Folder2\Folder3\Folder4\Folder5\My Report.xlsx|||My Report | My Report.xlsx |
This is possible using Text to column and I am able to get the desired result. but I want to reduce the clutter on my workflow and use the Regex Replace method but I could not figure out the syntax.
Any help would be appreciated.
Solved! Go to Solution.
@PKoya ,
Along with the request to have this solved using a Regular Expression comes the solution that isn't a regular expression. I commend your quest for knowledge, but all of the solutions provided give you little guidance as to how they work or if they are implemented well. I use regex101.com and with it comes an explanation:
FileGetFileName(Left([Input Field], FindString([Input Field], "|")))+FileGetExt(Left([Input Field], FindString([Input Field], "|")))
you solve it faster!
With 1,000,000 records I tested the regex 3 times:
Info: Formula (5): Profile Time: 5,518.52ms, 92.03%
Info: Formula (5): Profile Time: 4,590.08ms, 91.99%
Info: Formula (5): Profile Time: 4,174.64ms, 91.45%
The string formula tested with:
Info: Formula (3): Profile Time: 2,183.11ms, 83.62%
Info: Formula (3): Profile Time: 2,321.22ms, 84.44%
Info: Formula (3): Profile Time: 2,187.39ms, 84.33%
RegEx is generally 2-3 times more time consuming.
Cheers,
Mark
Thanks, @MarqueeCrew.
I will try and have a play around with it and see how it works.
I am pretty good with Python Regex but could not workout this specific one.