Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a method to escape "]", ")" and "," in regsub #200

tmccombs opened this issue Jul 30, 2019 · 2 comments


Copy link

commented Jul 30, 2019

Output of haproxy -vv and uname -a

$ haproxy -vv
HA-Proxy version 1.8.20 2019/04/25
Copyright 2000-2019 Willy Tarreau <>

Build options :
  TARGET  = linux2628
  CPU     = generic
  CC      = gcc
  CFLAGS  = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-unused-label

Default settings :
  maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with OpenSSL version : OpenSSL 1.0.2g  1 Mar 2016
Running on OpenSSL version : OpenSSL 1.0.2n  7 Dec 2017
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2
Built with Lua version : Lua 5.3.1
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Encrypted password support via crypt(3): yes
Built with multi-threading support.
Built with PCRE version : 8.38 2015-11-23
Running on PCRE version : 8.39 2016-06-14
PCRE library supports JIT : yes
Built with zlib version : 1.2.8
Running on zlib version : 1.2.11
Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with network namespace support.

Available polling systems :
      epoll : pref=300,  test result OK
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 3 (3 usable), will use epoll.

Available filters :
        [SPOE] spoe
        [COMP] compression
        [TRACE] trace

$ uname -a
Linux <redacted> 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

What should haproxy do differently? Which functionality do you think we should add?

I would like to be able to use capture groups and character classes in the regular expressions used in the regsub converter.

Currently, the documentation states:

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. The first use of this converter is to replace certain characters or sequence of characters with other ones.

Howerver, that prevents the usage of character classes and capture groups. As far as I can tell, there isn't any way to escape these characters in the regex.

What are you trying to do?

I specifically ran into this while trying to use regsub to transform the path i a http-requests set-path operation. In that particular case, I can continue to use reqrep in 1.8, and use replace-uri when I upgrade to 2.0. However, there are still cases where that won't work. For example if regsub is used in the expression with http-request set-var or if it is part of a chain with multiple converters.


This comment has been minimized.

Copy link

commented Aug 28, 2019


This comment has been minimized.

Copy link

commented Aug 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.