> Yes, but just having a more complete implementation of PCRE regex would make > a big difference. > For example, LC's regex does not include back references. > Having the ability to use (PCRE compliant) back references would, I believe, > in many case, eliminate the need for that array of matches. > For example....
>> The dictionary says "LiveCode implements regular expressions compatible with >> the PCRE library." Without back references the LC implementation is a rather >> limited subset of that library. Sorry to be a bit more precise, but actually back references *are* implemented. You can use them in the pattern matching, as: " (.)\1" I let the reader find what's for :) A regex engine needs 2 input: a text and a pattern matching and it returns true or false plus a list (generic word) of index if any captures. That's it. Everything else is *not* part of the regex engine. That said, implementing back references in the replacement text is and only is the responsability of Livecode engine! (see below) >> Example: >> I would expect to be able to do this in the message box: >> put replaceText("abcd","(ab)(cd)","$2$1") >> and get this: >> "cdab" Well, change $1 $2 by \1 and \2 and it will be less Perlish plus this syntax is already in use. What a pity you didn't manifest yourself here and at this time: http://forums.livecode.com/viewtopic.php?f=66&t=17412 I dropped all, feeling a bit lonely on this path.. >> Instead I have to do this: >> if matchText("abcd","(ab)(cd)",var1,var2) then put var2 & var1 >> >> But this is a trivial example. If either my string to search or my pattern >> is slightly more complex, then what would be a trivial task with full PCRE >> compliant regex becomes comparatively complicated in LC. Yes, speaking from experience, Perl and Regex are just "Wow" and they are fast; yes, fast! Why do you think I spent so much time developping a Perl external for Livecode some years ago. And if you don't believe a French guy, check how geneticians work with huge databases and DNA files.. Regards, Thierry ------------------------------------------------ Thierry Douez - http://sunny-tdz.com Maker of sunnYperl - sunnYmidi - sunnYmage _______________________________________________ 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