6

Using regex to get at filename

view full story
linux-howto

http://forums.opensuse.org – I need a way to seperate a file location from the file itself (or the file name, to be specific). I'm developing a web-app, and I need to be able to pull out a file's location and the file's name seperately in order to link to them. I.e, if I have a file at web-app/files/foo/bar.bas, I need to be able to pull of 1.) web-app/files/foo/ and 2.) bar.bas. I'm doing right now in Groovy (this is a Grails app), but I'm told that regex is much more efficient. I can use regex in Grails without trouble, but I am not familiar with it. I'm trying to learn it anyways, but I would greatly appreciate one of the gurus around here showing me who to hack this one. Thanks. (Distributions)