Error compiling VCL when using '% in regexp

Poul-Henning Kamp phk at
Mon Feb 8 11:53:20 CET 2010

In message <DD929CD9109B0A4D8C34B732A6D35CC43C34E274 at>, N
aama Bamberger writes:

>I get this error:
>Invalid hex char in %xx escape
>(input Line 107 Pos 28)
>        if (req.url ~ "(.*)%[0-9a-fA-F]$") {

Try: %25

One of the decisions I had most trouble with, was deciding which
kind of escape-mechanism we wanted for strings in VCL.

In the end I settled for URL-%xx encoding, because I pressume
webmasters know it, and because it avoids a nightmare of back-slashes
in regexps.

I'm not 100% convinced that was the perfect decision...

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.

More information about the varnish-misc mailing list