HAProxy community

Back-references in regsub?


Is there any way to use backreferences in the regsub converter? The docs state

“It is important to note that due to the current limitations of the
configuration parser, some characters such as closing parenthesis, closing
square brackets or comma are not possible to use in the arguments.”

I did some experiments with quoting the parentheses, but to no avail. I believe that would be a very useful feature, especially for working with txn variables, for example to extract some parts of a string.

http-request set-var(txn.myvar) var(txn.othervar),regsub(some-\(string\)-with-group,\1)

I came up with using a map file and map_regm, but it feels a bit overkill, plus it currently has issues.

So, may be I have overlooked how to use back references in regsub?

Thanks for any hints