100% Funded
33
backers
$4,000
pledged of $4,000 goal
0
seconds to go
33 backers pledged $4,000 to help bring this project to life.

Preserving formatting in find and replace

This month we are looking to fund preserving or changing formatting of found strings. This feature will optimize the coding process of find and replace in LiveCode saving you time and effort. Presently when trying to replace a string in a field all formatting would be lost without implementing a more time consuming workaround.

Preserving formatting in find and replace

The replace command is a staple of text manipulation in LiveCode. At present, its form is:

replace <string> with <replacement> in <target>

The command searches for the string <string> in <replacement> and then replaces any occurrences with the string <target>. A long standing limitation of the command is that if <target> is a field, then the styling on the text is removed.

We propose to add an implementation of the current command which performs the replace operations on the field ensuring formatting is preserved. The rule will be that any occurrences of <pattern> in the field will be replaced by <replacement> using the styling of the first character of the found instance of <pattern>. For example, let us say field 1 contains:

the quick brown fox jumped over the lazy dog

Then

replace “the” with “THE” in field 1

Would result in

THE quick brown fox jumped over THE lazy dog

Benefits

This feature will optimize the coding process of find and replace in LiveCode saving you time and effort. Presently when trying to replace a string in a field all formatting would be lost without implementing a more time consuming workaround. We are proposing a find and replace strings in fields feature whilst preserving the formatting.

If this project is successfully funded we estimate that we will commence development in December with an estimated final delivery in early February 2016.

7 comments

Join the conversation
  • Devin - November 19, 2015 reply

    May I suggest an option to preserve the current behavior? You could just add a ‘with formatting’ clause:
    replace “foo” with “bar” in fld 1 with formatting
    This nicely parallels things like:
    import snapshot from [object] with effects

  • Massimiliano - November 20, 2015 reply

    I would change this project title to “a new replace command”.
    If you don’t read all page project, you think that it’s related to the code editor.

  • Massimiliano - November 26, 2015 reply

    Hello,
    is there any web widget to embed in other website to promote this campaign?

  • Malte - December 10, 2015 reply

    Done. 🙂

  • Steve - January 3, 2021 reply

    Was this ever implemented?

    Heather Laine - January 5, 2021 reply

    Yes, it was. Check the dictionary for details, under the “replace” command.

  • Ifediogor Jefferey - December 28, 2021 reply

    preserving current behavior? I could just add a ‘with formatting’
    clause:
    replace “Alpha ” with “bar” in fld 1 with formatting
    This nicely parallels things like:
    import snapshot from [object] with effects


Leave a Comment

david simpson

Malte Brill

Bernd Niggemann

Mark Davis

Till Bandi

Udo Dreher

Massimiliano Vessi

Hermann Hoch

Michael Muthmann

Craig Newman

Jim Lambert

Devin N. Asay

Beda Sellung

Daniel Pierce

tomastoteles

Todd Fabacher

David Kesler

Jason Newberry

Mario Alojzije Lubina

Phil Jimmieson

Matthias Rebbe

Marc Ludvik

John Patten

ANDRE DETIENNE

Walter Brown

Scott Rossi

Ludovic THEBAULT

Stephen Barncard

Sorry there is no FAQ for now, ask a question
Mark WaddinghamPreserving formatting in find and replace