Forum OpenACS Q&A: Help needed for a Regular expression

Hi,

sorry , i know this is not a direct problem with OACS , i just dont know where else to ask about this.

i am having a problem trying to get a RE that will match what i need, im new with RE's and might be going about it the wrong way:

my problem ,

if i have  a string - > "top/Arts/music/opera/blah"

and i am trying to strip everything upto and including the last forward slash of the string, the thing is i can any number of forward slashes before that like
../../../../../../../../../../../blah

but i still just need the "blah"

i was trying to get it stripped from the back, but unsuccessful since im not very familiar with the tcl RE syntax

if anyone knows RE's and can help i would really appreciate it .

thankyou in advance

Collapse
Posted by Chris Davies on
set pathinfo "/asdfa/asdf/asdf/asdf/asdf/1234"
set endpart [lrange [split $pathinfo /] end end]
Collapse
Posted by abbas beginner on
thanks alot for that

makes sense now

Collapse
Posted by abbas beginner on
thanks alot for that chris

makes sense now

Collapse
Posted by Jamie Rasmussen on
You may want to look at tcl's file tail command.
Collapse
Posted by Don Baccus on
In other words set file_name [file tail $path_info]