Replace only certain text on a page

New to text blaze here, and I'm sure that this is extremely simple, but I can't find a forum post that directly answers my scenario:

When I have a document on my screen, I need my snippet to replace specific text with new text. Not replace everything, just certain words/placeholders in the text.

In my specific use case, my customer app will generate an invoice, which I do need as-is most the time, but I also want to sometimes convert it into an estimate by changing the title and adding a signature block in the specific part of the page.

I'm currently having to highlight the word "Invoice" and then use one snippet to replace it with "Estimate", and then I have to place my cursor in the spot where I want the signature block, and use another snippet to insert the signature block.

Can there be a snippet that does all this at once? Either selects-all (like CTRL A does) and replaces just certain words, i.e. "Invoice" with "Estimate" and a placeholder like "**" with the signature block text or that would somehow select just the desired text to replace (Invoice and the placeholder) and replace it with the new text (Invoice and the signature block).

Thank you in advance!

Hi Anthony, welcome to the community :tada:

You can do this with the {clipboard} command the the replace function. It would look like this:

{=replace({clipboard}, "Invoice", "Estimate")}

To use this, copy all of the text, run the snippet, and it will replace the word 'Invoice' with the 'Estimate'. You can use the same format to do the inverse as well as replace placeholders like '**' with specific words.

If you have any questions, please let me know.

Ok, so that sort of worked, but the page has a lot of table formatting and some images and when it pasted the document contents back in, it pasted the text back (including the replaced text!), minus the table formatting.The page seems to be rich text type formatting maybe?

So, perhaps the next question is, can a text blaze snippet select just certain words in a document? Sort of like a find>replace function?

The document I'm needing to modify is a browser-based form, which is great so that text-blaze can do it, but I can't use any type of automation functionality that might exist in word/google docs.

Hi Anthony,

You can use the replace function to replace words (no formatting), but as far as just finding the common words, either control+f or an external tool would be better suited to complete this task.

As for find & replace in situations with formatting, unfortunately we do not currently have a way to do this. As of right now, we don't have plans to add this functionality.