[master] 656cabe Expand on backslashes and quoting

Per Buer perbu at varnish-cache.org
Wed Oct 16 10:00:00 CEST 2013


commit 656cabe3de433012949be1e28419ad9034fc8ae4
Author: Per Buer <perbu at varnish-software.com>
Date:   Wed Oct 16 09:59:57 2013 +0200

    Expand on backslashes and quoting

diff --git a/doc/sphinx/users-guide/vcl-syntax.rst b/doc/sphinx/users-guide/vcl-syntax.rst
index 8277033..ce476b2 100644
--- a/doc/sphinx/users-guide/vcl-syntax.rst
+++ b/doc/sphinx/users-guide/vcl-syntax.rst
@@ -15,12 +15,21 @@ Strings
 
 Basic strings are enclosed in " ... ", and may not contain newlines.
 
+Backslash is not special, so for instance in regsub() you do not need
+to do the "count-the-backslashes" polka:::
+
+  regsub("barf", "(b)(a)(r)(f)", "\4\3\2p") -> "frap"
+
+Given that we have never been able to come up with a valid need for
+any escaped characters apart from that, we decided that %22 for " and
+%25 for %, was much less suffering than doubling all backslashes in
+regexp/regsub contexts.
+
 Long strings are enclosed in {" ... "}. They may contain any character
 including ", newline and other control characters except for the NUL
 (0x00) character. If you really want NUL characters in a string there
 is a VMOD that makes it possible to create such strings.
 
-
 Access control lists (ACLs)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 



More information about the varnish-commit mailing list