replaceword(
TEXT
,
OLDWORD
,
NEWWORD
)

The replaceword( function replaces a word with a new word.


Parameters

This function has three parameters:

text – is the item of text that contains the words you want to search for and replace.

oldword – the original word.

newword – the new word.


Description

This function replaces a word with a new word. Only entire words are replaced. The function is quite smart – it knows about punctuation, and it will match the capitalization of the word being replaced.

local mytext
mytext = "One, someone, one, (ONE), oneida."
replaceword(mytext,"one","uno") ☞ Uno, someone, uno, (UNO), oneida.

This function will only work for words that are either all lower case (three), all upper case (THREE) or with the first letter capitalized (Three or Apple Computer). It will not work for text that has other capitalizations, for example McConnell (and by “not work”, we mean the text will not be replaced at all). Use the replacewordexact( function if the text has non-standard capitalization.


See Also


History

VersionStatusNotes
10.0NewNew in this version.