How can I strip away formatting from an RTF file?

Devin Asay devin_asay at
Wed Jul 8 14:28:02 EDT 2015

On Jul 8, 2015, at 11:58 AM, Richard Gaskin <ambassador at> wrote:

> Replacing a single character should ideally only affect the text style for that character, even if it occurs in multiple places, so personally I would consider the second example a bug if it strips all styles from unaffected portions of the text.

This comment appears in the dictionary entry for replace:

"Important! You can use the replace command on a field, but doing so removes any formatting (fonts, styles, colors, and sizes) in the field. To work around this limitation, use the field's htmlText property as the source for replacement instead of using the field itself as the source.”

So it’s intentional. I suspect that speed is the issue here. Replace is dang fast, and I wouldn’t want it to be slowed down by forcing it to consider formatting. Especially when there are simple workarounds like the htmlText trick above or using replaceText().


Devin Asay
Office of Digital Humanities
Brigham Young University

More information about the Use-livecode mailing list