As Don pointed out, you can also use STRTRAN() instead of STUFF(). I don't know why I always forget that function :-)
>
>Here's a thought: You can determine the position of a "[" and "]" through the AT() function. So, the following loop will scan through all of them. I am assuming a modal form that returns the replacement value:
>
>nStartLeft=0
>nStartRight=0
>cMemoText=ALLT(table.memofield)
>cReplacementText=""
>DO WHILE AT(cMemoText,"[") # 0
> nStartLeft=AT(cMemoText,"[",nStartLeft+1)
> nStartRight=AT(cMemoText,"]",nStartRight+1)
> cTextToReplace=SUBSTR(cMemoText,nStartLeft+1,nStartRight-1)
> DO FORM frmGetReplaceText WITH cTextToReplace TO cReplacementText
> cTextToReplace="["+cTextToReplace+"]"
>
>***** You need the STUFF function here to stuff cMemoText with
>***** cReplacementTExt....I don't have the manual here and can't
>***** remember the exact command parameters.
>
> nStartLeft=nStartLeft+1
> nStartRight=nStartRight+1
>ENDDO
>REPLACE table.memofield WITH cMemoText
>
>
>>In part of my application, it is necessary to allow the user to replace one or more words/phrases in a memo field. The words/phrases to be replaced are enclosed in square brackets. What I want VFP 3.0 to do is "read" each replaceable word/phrase in turn, let the user enter other words/phrase to replace it, then go on to the next replaceable word/phrase.
>>
>>Any help on resolving this will be appreciated.
>>
>>Thanks,
>>
>>Alan
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05