replaceText problem

Kay C Lan lan.kc.macmail at gmail.com
Sat Jan 3 23:13:48 EST 2015


On Sat, Jan 3, 2015 at 10:41 AM, Peter Haworth <pete at lcsql.com> wrote:

>
> replaceText(pScript,"(^\s*breakpoint$"," ")
>
> Hi Peter,

If this is exactly how your script is written then I see two problems:

1) you need to actually put the result into something so:

put replaceText(pScript,"(?im)^\s+breakpoint$","--BREAKPOINT") into
tUpdatedScript

(it's one of my pet peeves with the Docs; the examples given are typically
unworkable as a straight Copy and Paste into a script  - but that's another
rant]

replaceText - a function, does not work like replace - a command

2) you have an opening ( prior to your ^. I think you meant to have (?m) or
even better (?im) so it's case insensitive and works multi-line but in your
troubleshooting maybe the ( got left behind.

I do what you do but instead of replacing the 'breakpoint' with nothing I
merely comment it out and make it STANDOUT - as shown in the code above.
Usually my hard breakpoints have ended up in their location because of some
long hard troubleshooting so I don't wish to loose them. if I ever need to
return to a handler for more troubleshooting, if there is the odd --
BREAKPOINT in there then the first thing I do is uncomment them and step
through and see what the variables are telling me.

HTH



More information about the use-livecode mailing list