replaceText() not working as expected for multiple lines

Thierry Douez th.douez at gmail.com
Sun Sep 21 03:39:12 EDT 2014


> The ^ (circumflex or caret) outside square brackets means look
> only at the beginning of the target string.",

This is true in default mode of the PCRE library.
There is a multiline mode which changes this behavior; the ^ will match
the begining of every line.

To be in multiline mode, just have to do what Peter said:

   add (?m) as a prefix of your regex.

>   so you could use a repeat loop

Don't need any repeat loop with replaceText().




> or just don't use the ^.
>
> If I put…
>
> /Users/hawk/bk_clients/blue aardvark/blue_aardvark____001.dhbk
>
> …into a variable tVar and use…
>
>    put replaceText(tVar,"/Users/hawk/bk_clients/",empty) into tVarOut
>
> …then tVarOut contains:
>
> blue aardvark/blue_aardvark____001.dhbk

> or simply…
>
>    replace "/Users/hawk/bk_clients/" with empty in tVar
>

Agree with you Paul, I would have done the same.


No need of ^ in this context, and no need of the  replaceText();
replace will do the job.


Have a nice sunday,

Thierry




More information about the use-livecode mailing list