Does anyone know a reliable plugin for Find and Replace [text]?

I’m still using Find and Replace V2 from Thierry Charbonnel, but it does not work well with nested symbols. I can only execute it once with the scope on ‘Selection’. Afterwards this scope is not available anymore. Does anynone know a good alternative for finding and replacing text in nested symbols?

1 Like

Of course I already have Automate, but ‘Change texts’ does not seem to work for text in symbols at all. The other one does not seem to have a scope option for ‘Selection only’ and last update was five years ago, so I didn’t try it. Does it work with symbols?

Select symbols manually or use Automate plugin for selection, then use the plugin that “does not seem to have a scope option” by selecting tab “Layers” and it’s done.

Screenshot 2024-01-17 at 15.15.35

Ok, I tried that, but sadly, this does only replace the first instance, no matter if I select the whole symbol or the text layers inside the symbol.

Do you have any ideas why, or further alternatives?

Symbol selected:
symbol

Text layers selected:
Screenshot 2024-01-17 at 17.00.56

The first attempt was almost perfect :smiling_face:. Simply select all the symbols you want to edit, and then use the Find and Replace Text plugin as you did.

You can select all symbols at once by using this option:

I think we have a small misunderstanding. The whole column is one symbol with several sub-symbols inside. I didn’t make that clear enough, my bad.

No matter if I select the parent symbol, the sub-symbols or the text elements inside the sub-symbols, the plugin only changes the first instance of the string I want to replace.

I ran a test and am getting the same results as @fab1An. Find and Replace text plugin is not changing the text of nested symbols. I tried “Change Texts” from automate as well and it’s not working. So, it would seem neither of those will do what you need :frowning_face:

Can you share your .sketch file?

I created a local file that (hopefully) does not depend on our library.

testfile replace text.sketch (192.3 KB)

Two hacks I’ve spotted:

  1. You can click [Layer] → [Replace] → [Layer] → [Replace] → [Layer] → [Replace] → [Layer] → [Replace] as many times as you need, and the plugin will do the job. Just select all the layers before. It’s not perfect, but it works. I can’t say why the [Replace all] button is not doing the job in that case.

  2. The second hack/thought is that you can edit these texts on the Symbol page. Just create as many variants of the table as you need.

table.variant-1
table.variant-2
table.variant-3

All of the variants should be created with the same cells/rows/headers symbols. To make it easy, just duplicate variant1, rename, and change the texts on it with the Find/Replace plugin.

Than on your destination Page, you can choose between variants

Thank you for your engagement. The fastest way currently is to change the texts manually, because the replace function does not recognize spaces in the input, so you can not delete Elements without keeping additional white space.

It doesn’t make sense for us to create our tables with the changed texts in it. They’re far too generic and are even filled with variable data here and there.

Like Jason said, I think there’s no plugin for find&replace text that works with Sketch’s current version and nested elements. I came to terms with this fact :slight_smile:

@fab1An I think I found a plugin that does it! It’s one that hasn’t been updated in 3 years but I tried it out on your sketch file and it worked!

replace-text

Hey Jason, thank you for your search!
But … :smirk: … well, I don’t know how to … I hope you’re not upset, but this is the plugin that started my search for an alternative, the one I linked to in my initial post.
I use it for years. When it works, it’s the best. But it has a problem: It loses the scope option for ‘selection’ after using it once or twice. Replacing text on the entire page or even the whole document is not what I need. I don’t know how to get the ‘selection’ option back or why it vanishes in the first place. Some weird bug, I guess.

At this point I assume that many plugins that are a few years old will have problems, especially when handling (nested) symbols, because of the changes in Sketch in the last years.

D’oh I’m an idiot! For some reason I thought you were talking about the “Find and Replace Text” plugin, but now that I look back I see you weren’t. Sorry about that.

Yeah, it looks like there’s nothing available for what you need :frowning:

Thanks to @rodionovd who had the right idea via direct message.

I had to reset the settings for this plugin (click the ?, then scroll down). After I did this, the option for ‘selection’ was back and the plugin worked well as it did before.

1 Like

OK so for those interested in the subject, @fab1An and I got to the root of this issue with Find and Replace plugin missing its vital bits of functionality out of the blue: it’s regular expressions that are causing unavoidable troubles.

I’ve published a fix as a PR on GitHub: Fix passing state containing regex with backslashes down to the webview by rodionovd · Pull Request #132 · thierryc/Sketch-Find-And-Replace · GitHub

(there’s also a link to download a fixed version of the plugin in there. Please use it until the plugin author merges the PR and releases a proper update).

1 Like