Rex help

Post Reply
Posts: 51
Joined: Tue Jun 03, 2003 3:38 am

Rex help

Post by josmani »

Hi guys,

Would be grateful if you can help me with the following REX expressions.

1. Want to search for the first occurrence of an image tag in a document <img src="some url" alt="possibly some text" />. $ret needs to have the the whole tag.

2. I have a URL structure like "/category/subcategory/docid/sometext.html". I need to get each element (category, subcategory, docid, sometext) in to separate variables.

Many thanks for your usual help.
User avatar
Site Admin
Posts: 5505
Joined: Tue Apr 25, 2000 6:56 pm

Rex help

Post by mark »

1. <rex ">>=!<img\P*<img=[^>]+>" $data>

2. <split "[/.]" $data>
$ret will be an array of all values. You can extract a single item with
<loop max=1 skip=$n $ret><$varn=$ret></loop>
Where $n is the array index. 0 is the first element.
Post Reply