Mailing List Archive

r1691 - trunk/varnish-cache/man
Author: des
Date: 2007-07-13 16:27:55 +0200 (Fri, 13 Jul 2007)
New Revision: 1691

Modified:
trunk/varnish-cache/man/vcl.7
Log:
Document regsub().


Modified: trunk/varnish-cache/man/vcl.7
===================================================================
--- trunk/varnish-cache/man/vcl.7 2007-07-13 11:42:02 UTC (rev 1690)
+++ trunk/varnish-cache/man/vcl.7 2007-07-13 14:27:55 UTC (rev 1691)
@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
-.Dd July 5, 2007
+.Dd July 13, 2007
.Dt VCL 7
.Os
.Sh NAME
@@ -116,6 +116,27 @@
pipe;
}
.Ed
+.Ss Functions
+The following built-in functions are available:
+.Bl -tag -width indent
+.It Fn regsub "str" "regex" "sub"
+Returns a copy of
+.Fa str
+with all occurrences of the regular expression
+.Fa regex
+replaced with
+.Fa sub .
+Within
+.Fa sub ,
+.Va $0
+(which can also be spelled
+.Va & )
+is replaced with the entire matched string, and
+.Va $n
+is replaced with the contents of subgroup
+.Ar n
+in the matched string.
+.El
.Ss Subroutines
A subroutine is used to group code for legibility or reusability:
.Bd -literal -offset 4n
@@ -145,7 +166,7 @@
request should be handled.
Each subroutine terminates by calling one of a small number of
keywords which indicates the desired outcome.
-.Bl -tag -width "vcl_timeout"
+.Bl -tag -width indent
.\" vcl_recv
.It Cm vcl_recv
Called at the beginning of a request, after the complete request has
@@ -156,7 +177,7 @@
The
.Cm vcl_recv
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -186,7 +207,7 @@
The
.Cm vcl_pipe
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -205,7 +226,7 @@
The
.Cm vcl_pass
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -218,7 +239,7 @@
The
.Cm vcl_hash
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm hash
Proceed.
.El
@@ -230,7 +251,7 @@
The
.Cm vcl_hit
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -253,7 +274,7 @@
The
.Cm vcl_miss
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -274,7 +295,7 @@
The
.Cm vcl_fetch
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -294,7 +315,7 @@
The
.Cm vcl_deliver
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm error Ar code Op Ar reason
Return the specified error code to the client and abandon the
request.
@@ -309,7 +330,7 @@
The
.Cm vcl_timeout
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm fetch
Request a fresh copy of the object from the backend.
.It Cm discard
@@ -324,7 +345,7 @@
The
.Cm vcl_discard
subroutine may terminate with one of the following keywords:
-.Bl -tag -width "discard"
+.Bl -tag -width indent
.It Cm discard
Discard the object.
.It Cm keep
r1691 - trunk/varnish-cache/man [ In reply to ]
In message <20070713142755.C07C31EC418 at projects.linpro.no>, des at projects.linpro
.no writes:

>Document regsub().

We should probably mention the limitations:

We should probably mention that regsub() is not a general subroutine,
it is only available in "set" statements that set string variables.

Similarly, the string concatenation is also only available in set
of string variables.


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.