All-

Yesterday I had a need for a utility function that returns the text
between two HTML tags, so I cobbled this together, but it will work
for any text, not just tags. If you have, for example,

pText = "<a href='x.html'>click here<h3>This is a title</h3></a>"

you can call

put MatchWithin(pTtext, "<h3>", "</h3>")

and get "This is a title"

Any comments? Can it be made easier? Faster? Is there a better way to
do this?

FUNCTION MatchWithin pRawText, pStartText, pEndText
    local tReturn
    
    IF matchText(pRawText, "((?Uis)" & pStartText & "(.+)" & pEndText& ")", 
tReturn) THEN
        delete char -length(pEndText) to -1 of tReturn
        delete char 1 to length(pStartText) of tReturn
    END IF
    return tReturn
END MatchWithin

-- 
-Mark Wieder
 [EMAIL PROTECTED]

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to