Retrieving text within 2 tags

Mark Smith lists at futilism.com
Fri Aug 1 19:55:43 EDT 2008


Mark, this is one way (this way only returns the first tag of a give  
name), but there could be many others.

function extractTaggedText pText, pTagName
    replace "<" & pTagName & ">" with numtochar(4) in pText
    replace "</" & pTagName & ">" with numtochar(4) in pText
    set the itemdelimiter to numtochar(4)
    return word 1 to -1 of item 2 of pText
end extractTaggedText

Best,

Mark

On 2 Aug 2008, at 00:34, mfstuart wrote:
>
> Hi all,
>
> RunRev: 2.90
> OS: WinXP
>
> How would I retrieve text that is within 2 tags, that has been put  
> into a
> memory variable?
> The text originated from a web site, using command "put url theURL  
> into
> tData".
> Such as:
>
> <MyText>
> This is some text I would like to
> retrieve. It is on many lines
> and all the text has to be return
> within the tags.
>
> Also, the text could have HTML formatting in it.
> </MyText>
>
> I don't know how to use the XML commands in rev as yet (a  
> possibility), so I
> would like to use the text chunk commands to do so.
>
> TIA.
> Mark Stuart
> -- 
> View this message in context: http://www.nabble.com/Retrieving-text- 
> within-2-tags-tp18784278p18784278.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list