Replace regex for capture group

I have a text field which currently has values that are comma separated.

I need the strings separated by square brackets instead.

The AI function in Fibery’s formula and ChatGPT both offers the same solution.

ReplaceRegex(Name, “^(.*)$”, “[$1]”)

But it seems that Fibery can’t handle the capture group since the outcome is [$1].

Does anyone know how to solve this?

Thanks!

Try this:

ReplaceRegex(
  ReplaceRegex(
    ReplaceRegex(Text, "(?<=\w)$", "]"),
  "^(?=\w)", "["),
", *", "][")

It adds ] at the end, adds [ at the beginning and then replaces every instance of , or , with ][

Note: It assumes that there are no line breaks in the source string

Awesome :star_struck: Works like a charm. Nothing beats ChrisGPT :smirk: