2016-09-17 0:13 GMT+02:00
Dr. Hawkins <doch...@gmail.com>:

I need to catch every instance of
>
> getVal(a,b,c)
>
> and change them to
>
> getVal(a,b,c,dbtr)
>
> (and similarly to find when called with one or two arguments)
>
> dbtr is the variable name I want to pass.
>


​Here is one way to do it.


*on* mouseUp

*put* "getVal\([^)]+(?=\))" into theRegex

*put* "\0,dbtr" into smartReplaceText

*if* sunnyreplace( fld "f1", theRegex, smartReplaceText, outText) *then*

*put* outText into fld "f2"

*end* *if*

*end* mouseUp

​

​some sample input text in fld "F1" :

get getVal(a)

put getVal(a,b) into z

put getVal(a,b,c) && getVal(a,b,c) into y


and results in fld "f2":

get getVal(a,dbtr)

put getVal(a,b,dbtr) into z

put getVal(a,b,c,dbtr) && getVal(a,b,c,dbtr) into y


Is this what you are looking for?

Regards,

Thierry
​


------------------------------------------------
Thierry Douez - http://sunny-tdz.com
sunnYrex - sunnYtext2speech - 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

Reply via email to