How can I use Find and Replace to replace certain text with a carriage return?

In some text I’ve imported there are various occurrences of “%%” throughout the text.

I would like to replace each occurrence of “%%” with a carriage return.

Using the Find and Replace menu item I’ve been able to find each occurrence of “%%” but don’t know what to put in the Replace field to replace it with a carriage return.

I’ve already tried “\n” and “\cr” without success (“%%” is just replaced with those characters).

I’ve also search this forum, the web, and the online documentation without success.

Thanks in advance.

Nevermind, I just found this dropdown in the Find And Replace window. I think it will allow me to do what I want to do.

That worked.

You know, another and possibly more convenient way of doing this is to use a stamp, i.e., do it with action code:

$Text=$Text.replace("%%”,"\n").

\n represents a carriage return.

Small operations like this are a great way to learn action code. This same action code works in rules, editcs, onvisits, on revoves, macros, etc.

2 Likes

@satikusala - Thanks for the suggestion.

I created a stamp like you suggested (see screenshot below) but whenever I apply it to a note the entire text disappears instead of being replaced (it happens whether I pre-select the entire text or not).

I did try this other test stamp, which worked (the text " HELLO" was appended to the $Text without having to select it).

I am using Tinderbox v8.7.1.

Hmm…I just tried this an it works fine for me.

original:

Stamp applied

I’m on 10. I can’t image that the version makes a difference. Try attached.

TestReplace.tbx (112.0 KB)

@billmaya, looks like you’ve got a curly quote that snuck into the stamp’s code.

CleanShot 20240914 at 15.11.29@2x

Yup, that would do it. :slight_smile: Nice catch @PaulWalters.

By the way, the version of Tinderbox you’re using, 8.7.1, is more than four years old.

There have been 20 public releases, and lot more backstage releases, since 8.7.1.

1 Like

@PaulWalters - Thanks.

@eastgate - Thanks. I’m aware of how far behind the current version I am. Plan on upgrading at some point but wanted to see if if Tinderbox was appropriate for a project I’m working on (looks like it might be).

Testing out your project with the current version would both assist the forum in pinpointing any issues you have, and also ensure that you’re leveraging the most recent developments in the software - there have been MANY since ver. 8.7.x.

Unless you’re using an antiquated MacOS version, there’s no reason not to download and use the latest demo from www.eastgate.com. Presumably, your currently installed 8.7.x version is also functioning in demo mode.

No, in the past I purchased a copy of Tinderbox and subscribed to the upgrade plan but let it lapse for reasons I can’t remember.

1 Like