regex help please
Andre Garzia
andre at andregarzia.com
Thu Feb 9 15:38:45 EST 2012
Klaus,
I used to work like that, doing little XML files with RegEx and matchText.
After working like that for a long time, I came to realize that there was
no advantage at all in my case. It was simpler to work with RevXML. The
problem with RegEx is all the little cases where it fails. I think you
should use RevXML, it might look overkill but it will cut your debug time a
lot.
Cheers
andre
On Thu, Feb 9, 2012 at 6:24 PM, Klaus on-rev <klaus at major.on-rev.com> wrote:
> Hi friends,
>
> in my current project I need to deal with VERY small XML files
> with maybe up to 20 entries.
>
> So using the XML external seems to be a bit overkill.
>
> Some time ago I found a little reg ex here on the list which I turned
> into a function and will return me everything inside of a given XML tag:
> ...
> <tag1>bla bla</tag1>
> <tag2>more bla bla</tag2>
> ...
>
> So with this text above in tText and "tag2" int tTag:
>
> function mk_getXMLdata tText, tTag
> get matchText(tText,"(?s)<" & tTag & ">(.*?)</" & tTag & ">",tValue)
> return tValue
> end mk_getXMLdata
>
> will give : more bla bla
> So far so good, I even almost understand the reg ex ;-)
>
> Now I am looking for another little snippet to (over) write something
> in(to)
> a certain TAG, know what I mean?
>
> If someone could supply a nifty "replacetext" snippet that would be great!
> :-)
> Thanks in advance!
>
>
> Best
>
> Klaus
>
> --
> Klaus Major
> http://www.major-k.de
> klaus at major.on-rev.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
--
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.
More information about the use-livecode
mailing list