Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
--Mark's method above WORKS - for an individual line.
--I'm not absolutely sure how you want the final list to be rewritten but this should help track down what you need to do,
--if you need to replace multiple lines which may or may not be the case.
put "Mike Watkins" & cr & "Mike" & cr & "Mike Baker" & cr & "Mike" & cr & "Mike Peabody" & cr & "Mark" into theList
put "Mel" into theNewName
put "Mike" into theOldText
set the wholeMatches to true
--no "THE" with a function, it's not a property
put lineoffset(theOldText,theList) into changeLine
put line changeLine of theList into tChangeMe
--the bit here:
--[line changeLine of theList]
--resolves to "Mike" in this case, so
--your line:
--replace line changeLine of theList with theNewName in theList
--is equivalent to saying:
--replace "Mike" with "Mel" in theList
--so try:
replace cr & line changeLine of theList & cr with cr & theNewName & cr in theList
--as a quick and simple way to restrict the change to the whole line without resorting to regex
I was responding to a *very specific* use case here. SparkOut is right in that you shouldn't have "the" before the function call... I noticed that and forgot to comment on it.
For a more general use, you've already found how to replace *all* occurrences. You'd need a loop if you want to replace more than one and less than all.