[Varnish] #249: regsub

Tomas Ebenlendr ebik at jyxo.com
Mon Jun 16 11:47:25 CEST 2008


Varnish wrote:
> #249: regsub
> ----------------------+-----------------------------------------------------
>  Reporter:  ebik      |        Owner:  phk  
>      Type:  defect    |       Status:  new  
>  Priority:  normal    |    Milestone:       
> Component:  varnishd  |      Version:  trunk
>  Severity:  normal    |   Resolution:       
>  Keywords:            |  
> ----------------------+-----------------------------------------------------
> Changes (by phk):
> 
>   * owner:  des => phk
>   * component:  build => varnishd
> 
> Comment:
> 
>  Why does your patch remove support for the '&' replacement ?
> 
>  Poul-Henning

In fact, that patch should be split in two patches: one replacing 'sub' with 's'.
(Because this is fix).

And another with removing '&' and adding '$$'. (Because this is feature.)

I need to get from "/foo/bar" to "/article?section=foo&id=bar" and I have no way
how to include '&' in result of substitution now.
I want: regsub(req.http.location,"/([a-z]*)/([a-z]*)","/article?section=$1&id=$2"),
but I want to somehow 'escape' the '&'.

I removed '&' because '$0' does the same. Maybe we can add '$&' to be consistent
with perl.



More information about the varnish-bugs mailing list