merkaba 36 Posted July 2, 2012 Report Share Posted July 2, 2012 I've been staring ubot like an idiot for about 2 hours now stuck on a hang up. Breaking it down, I have the following : Open file > with a variable attached to it. I want to take that variable and parse it for the file name/extension ie remove everything bolded C:\Users\name\Desktop\folder\example.txt and leave just the file name, but do so in such a way that it doesn't matter how whats in front of the file name. Anyone have a solution to this? Quote Link to post Share on other sites
warriorfullights 0 Posted July 3, 2012 Report Share Posted July 3, 2012 It looks like this post has been doubled.. Anyway, have a good day. Quote Link to post Share on other sites
dmbfan 9 Posted July 3, 2012 Report Share Posted July 3, 2012 I would do a find by regular expression on the variable using the following regex code: \\[a-zA-Z0-9]*\.[a-zA-Z0-9]* Then in the next step I would do a replace on that same variable searching for \ and replacing it with $nothing. That should leave you just the file name Quote Link to post Share on other sites
Legend 181 Posted July 4, 2012 Report Share Posted July 4, 2012 You can combine/condense those steps with: set(#file name, $replace($find regular expression($find regular expression(#file name, "\\\\[a-zA-Z0-9]*\\.[a-zA-Z0-9]*"), "\\\\[a-zA-Z0-9]*\\.[a-zA-Z0-9]*"), "\\", $nothing), "Global") might be a hiccup with multi-word file names though... http://www.ubotstudio.com/forum/public/style_emoticons/default/blink.gif Quote Link to post Share on other sites
Praney Behl 314 Posted July 4, 2012 Report Share Posted July 4, 2012 If Regex is not your game then here is an easy alternative for you: Code:add list to list(%sample, $list from text("C:\\Users\\name\\Desktop\\folder\\example.txt", "\\"), "Delete", "Global") set(#filename, $list item(%sample, $subtract($list total(%sample), 1)), "Global") Hope it helps Praney Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.