How to find and replace

Dar Scott dsc at swcp.com
Mon Jun 6 18:39:49 EDT 2005


On Jun 6, 2005, at 2:36 PM, Christian Langers wrote:

> I need to do the following :
>
> repeat with x=1 to the number of chars of the clicktext+5
>     put "_" after char x of tChar
>     end repeat
>
> replace the clicktext with tChar in fld 1
>
> where i want the exact word to be replaced...
>
> e.g.  I click  "da" and I just want this to be replaced in the field 
> (not  "das", "Dach","Dame",...)
>
> How can I solve this ?

A regular expression may include \b to match at a word boundary, even 
at the start or end of a string.  Perhaps you can build up a regular 
expression and use replaceText().  (A "word" is a sequence of ASCII 
underscore, letter or digit that is bound by non-word characters or 
string boundary.)

The replaceText() function is improved for speed in Revolution 2.6, I 
understand.

Dar

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming and software
**********************************************



More information about the use-livecode mailing list