Regex redirect with substitution


We need to redirect all paths that match something-de-de.pdf to de-de/doc.pdf where de-de is a variable country code.

So the ACL looks like this:

acl needsredirect path_reg ^/.*[a-z][a-z]-[a-z][a-z].pdf$

That ACL is working just fine but I wonder how to define the redirect then. I’ve tried this:

http-request redirect code 301 location %[path,regsub(^/.*([a-z][a-z]-[a-z][a-z]).pdf$,\1/doc.pdf,g)] if needsredirect

but that fails parsing at the first ] of the search string in regsub. The samples in the documentation are not showing anytrhing similar to this so I wonder how I should be doing this.