# Regexreplace multiple strings in a loop with FORMATTING?

**URL:** <https://connect.superhuman.com/t/regexreplace-multiple-strings-in-a-loop-with-formatting/48226>\
**Category:** Ask the Community\
**Created:** [April 24, 2024, 11:15am UTC](https://connect.superhuman.com/t/regexreplace-multiple-strings-in-a-loop-with-formatting/48226 "2024-04-24T11:15:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Paul\_Danyliuk](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/paul_danyliuk/32/27228_2.png) [@Paul\_Danyliuk](https://connect.superhuman.com/u/Paul_Danyliuk)\
**Post date:** [April 24, 2024, 12:07pm UTC](https://connect.superhuman.com/t/regexreplace-multiple-strings-in-a-loop-with-formatting/48226/2 "2024-04-24T12:07:28Z")

</div>

Oh, I remember pulling this off quite a while ago. Of course I wouldn’t find it now 😅

I recently solved a somewhat similar thing. It was about replacing `{{Named}} {{parameters}}` with ready-to-`Format()` placeholders like `{1} {2}` etc. and applying proper values to those. And my solution preserved formatting. I have only recorded a very improvised video on that, which I shared with patrons, but I was too overwhelmed to make a proper tutorial out of it yet.

The short answer is, it’s only possible with some effort. I don’t remember if Substitute preserves formatting (probably not / not yet?) but RegexAnything functions for sure don’t.

* * *

P.S. Oh, I guess that’s it. Here I was replacing sought words with underlined versions of them.  
RegexExtract isn’t a hidden formula anymore, and we didn’t have WithName back then, so today you can easily make it into a single formula.

> [@Highlight words in column based on master list of words](https://connect.superhuman.com/t/highlight-words-in-column-based-on-master-list-of-words/17458/5):
>
> Here’s a solution that can match phrases. It’s a multi-step one though. Also it should be a more robust one than the one above, since it doesn’t split the text by every word but only wherever necessary to then stitch it back. It uses a hidden RegexExtract formula; it supports flags so instead of using Lower() elsewhere I just set it up to work as case-insensitive.

---

_[View the full topic](https://connect.superhuman.com/t/regexreplace-multiple-strings-in-a-loop-with-formatting/48226)._
