Capture data from string using regular expression


1 comment

  • Leon Brocard

    [quote="Suraj_Dalvi, post:1, topic:1066"] image/png [/quote]

    Hi Suraj,

    Something like the following should extract the png part of image/png:

    ```vcl if (req.http.Content-Type ~ "^(.+)/(.+)$") { set req.http.type =; }

    if req.http.Content-Type is "image/png"

    then req.http.type is now "png"


    We cover capturing matches in more detail (with examples) in our documentation:

    Regards, Léon

    Comment actions Permalink

Please sign in to leave a comment.