โ07-19-2024 09:59 AM
I need to extract and store the File Path and Filename.EXT from a string into 2 variables.
example: \\Server\folder\folder\filename.ext
I want to end up with:
Variable1 = "\\Server\folder\folder\"
Variable2 = filename.ext
Is regex the best way to accomplish this, or is there another built-in method for parsing something like this?
Solved! Go to Solution.
โ07-19-2024 10:07 AM
Try these:
[path data pill].split('\\').last
and
[path data pill].split("\\")[0..-2].join("\\")
The last one will return "\server\folder\folder", so you could just manually add the another "\" at the start and end.
โ07-19-2024 10:07 AM
Try these:
[path data pill].split('\\').last
and
[path data pill].split("\\")[0..-2].join("\\")
The last one will return "\server\folder\folder", so you could just manually add the another "\" at the start and end.