Regex capture group

Does the regexreplace() function support capture groups? Are there any plans to add this feature? I know there’s an action that supports capture groups, but I’d have more flexibility being able to specify the capture groups myself.

You can encapsulate everything inside groups, no matter if you need to identify them or not. That way, you can use them in your replacement string. For example:

let text = "foo123bazqux foo456bazqux"
regexreplace(text, "$2-$4", "(foo)(\d+)(baz)(.)")

Result: 123-qux 456-qux