>> Nonetheless, if you want to continue down the regex path, try
>> something like
>> 
>> get matchText(tText,"(?s)<" & tTag & ">(.*?)</" & tTag & ">",tValue)
>> replace "<" & tTag & ">" & tValue </" & tTag & ">" with
>> "<" & tTag & ">" & tNewValue </" & tTag & ">"
>> in tText
> 
> well, I did not want to pass the text that I want to overwrite in the XML, 
> which I do not now in that moment!
> But this is neccesary in Mark's and "zalgo/tony the coming pony"s (????? :-D 
> ) scripts.
> 
> I only want to pass the XML text, the tagname and the NEW text to be place 
> inside of these tags.

Mark Weider's code will work for you, Klaus… the "tValue" is something that the 
matchText function FILLS with the current text inside the brackets, so you 
don't need to know it ahead of time.

The "(.*?)" is a way to "capture" what is between the tags, and the 3rd+ 
parameters to he matchTextFunction are variables that are provided to the 
function that get filled with whatever is being captured. The matchText 
function returns either 'true' (if it can find what you are looking for) or 
'false') if it can't. Mark's code above assumes a 'true' result by using "get".

Here's an example that takes into account the possibility that you may not 
match what you're looking for:

put "<tag>Hello</tag>" into tData
if matchText(tData,"(?s)<tag>(.*?)</tag>",tValue) = "true" then
   put tValue  -- Since this matches, you'll get "Hello" in the msg box
else
   put "No Match"
end if
> 

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/  

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to