Forum Academy Marketplace Showcase Pricing Features

Faster find & replace?

I’m building a template system that takes words that are in [ ] and replacing them by information on the page using a string of find & replace expressions.

Unfortunately, this slows down the displaying of the text quite a bit. Is there a way to speed this up, or a whole different approach to the problem ?

Happy to pay if there is some coding involved.

Can you tell me a bit more about what you’re doing? I have a few solutions for you based on usecase

1 Like

Awesome. Thank you @chris.williamson1996.

I store the model as a text in a table with [dynamic fields] in brakets.

On the user facing page, several things are happening:

  • when the user chooses a model it loads the text from the table :
    1. I show / hide the selection or input fields on the left based on the […]
    2. The rich text input (in grey) has the initial content set to “model text” then a lot of find & replace actions for every possible […] option and a bb highlight to show the user where the fields are dynamic.
    3. When the user changes the drop down arguments on the left, it updates the rich text input text

The problems I’m facing are two fold:

  1. The initial load is pretty slow and a little random (4 - 10 seconds) as it runs through the “find and replace” items
  2. In some instances my argument fields are input text (not drop down), and the text “drops” after I type the first letter to update the rich text which makes for a pretty crappy user experience :slight_smile: I could always create a “hidden field” that updates only when the visible input field finishes updating and use that in my find and replace, but if there is another “cleaner” way, I haven’t found it.

Does this help ?