search for regular expression in text and put the results into an array

Sarah Reichelt sarah.reichelt at gmail.com
Wed Nov 4 19:54:12 EST 2009


> I have an XML file which looks similar like this.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <statuses type="array">
> <status>blah blah bla
>   <some other>blah blah blah
>      <and so on></status>
>
>
> The <status>...</status> part is repeating many times, but with different content.
>
> i want to put the <status>...</status>part  into an array. So i get to know how often this part is in the xml file. I then want to extract some text of each of this <status>....</status> section. My main problem is how to seperate each <Status...> </status> section. Do i have to use the XML library? Or is there another way?


You can use the XML library, but for this case, it's probably just as
easy to use standard chunking commands.
Assuming you have the XML in a variable, you can loop through getting
the offset of <status> and the offset of </status> and getting what is
in between until there are no more to be found.

Cheers,
Sarah



More information about the use-livecode mailing list