Standard Library

Charles E Buchwald charles at buchwald.ca
Wed Aug 13 04:45:03 EDT 2014


Hi Thierry,

OK, well, cool.... But can you help me understand?

Do you mean if I put this in the message box, making the replacements you suggest:
    put replaceText("abcd","(ab)(cd)","\2\1")

I should get:
    cdab

Because I get:
    \2\1

What am I missing?

Cheers,
- Charles

On 12 Aug 2014, at 11:38 PM, Thierry Douez <th.douez at gmail.com> wrote:

> 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.

--
Charles E. Buchwald
CEO/Director General
Museografica Digital
http://digital.museografica.com

Mac OSX 10.9.4, LC 6.6.2 Commercial

LC Developer Tools: http://buchwald.ca/developer-tools/

Email Notice: http://wp.me/P3aT4d-33





More information about the use-livecode mailing list