Salesforce, Python, SQL, & other ways to put your data where you need it

Need event music? 🎸

Live and recorded jazz, pop, and meditative music for your virtual conference / Zoom wedding / yoga class / private party with quality sound and a smooth technical experience

Find and replace Pardot PML with HML

08 Sep 2022 🔖 pardot salesforce vscode tips
💬 EN

One of my colleagues needed to migrate dozens of e-mail templates from an older instance of Pardot to a newer one. The new Pardot kept complaining that old templates were in Pardot Merge Language (“PML”), e.g. %%first_name%%, instead of Handlebars Merge Language (“HML”), e.g. {{first_name}}. Here’s how I helped do the find-and-replace:

  1. Download, install, and open Notepad++, or some other text editor capable of doing find-and-replace with regular expressions.
  2. From old-Pardot, copy the HTML code (don’t be in the visual editor – be in the code editor) that you need to tidy up into a blank document in Notepad++.
  3. Make sure your cursor is at the beginning of the document, because sometimes “replace all” actually behaves as “replace all forward of this point” in Notepad++.
  4. In the toolbar, use Search -> Replace (or hit Ctrl + H).
  5. In “Find what,” enter: %%(\w+)%%
    • This means:

      “find me a piece of text starting with %%, followed by 1 or more characters that are ‘alphanumeric or an underscore’ (\w+), followed by another %%. And take note ((...)) of whatever’s in between the %%’s as ‘variable #1.’”

    • You can tweak the \w+ if you need to – I’m not sure exactly what’s inside the %%’s of Pardot variable names. “Alphanumeric or an underscore” was just my first guess. is a great website for testing how well patterns like %%(\w+)%% actually work as you invent them.
  6. In “Replace with,” enter: {{\1}}
    • This means:

      “Whatever you just found, replace the whole thing with {{, followed by the stuff you saved out as ‘variable #1’, followed by }}.”

  7. In “Search Mode,” choose the “Regular expression“ radio option.
  8. Click the “Replace All” button.
  9. If you need to replace any variable names, like changing first_name to Recipient.FirstName, then in “Search Mode,” choose the “Normal“ radio option and replace {{first_name}} with {{Recipient.FirstName}}, for example … repeat for all variable names that have changed from old-Pardot to new-Pardot.
  10. Copy the HTML out of Notepad++ and paste it into the new Pardot.
  11. See if new-Pardot is happy with your new-and-improved HTML code.
  12. Repeat for the e-mail’s text version, if needed.
  13. Repeat for the next e-mail you need to migrate.


It’s a similar concept in VSCode as Notepad++, where you put the find-and-replace tool into “Use Regular Expression” mode while replacing PML with HML. (Alt + R to toggle it on and off).

  1. The find-phrase will still be %%(\w+)%%
  2. In VSCode, the replacement is {{$1}} (with a dollar sign instead of a slash).
--- ---