split question

Post Reply
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

split question

Post by gerry.odea »

I'm trying to do the following and it's not working. Can you tell me what I am doing wrong?

<$dmozdir = /Top/Arts>
<split "/" $dmozdir><$dirq = $ret>
dirq=$dirq

it is giving me dirq=

when I was expecting it to give me dirq= " Top Arts"
and what if I just wanted to pull out the "Arts" portion is there a way to pull the last variable of $dmozdir into $dirq like if I had /Top/Arts/Movies all I want is the last "Movies"
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

split question

Post by mark »

That will give you an array of 3 items, "" "Top" and "Arts". <loop> over $ret to see them all.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

split question

Post by mark »

<rex "[^/]+>>=" $dmozdir><$last=$ret>

Or, if you're using the split data for other things too
<split...>
<loop max=1 rev $ret><$last=$ret></loop>
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

split question

Post by gerry.odea »

Thank you Mark! I actually just found you answered a similar post and found the answer.
<rex "[^/]+>>=" $dmozdir><$dirq = $ret>
Post Reply