can a map + regex be used to generate variables for YYYY-MM-DD-HH?

newnovice nginx-forum at nginx.us
Thu Oct 23 06:00:44 UTC 2014


can a map + regex be used to generate variables for YYYY-MM-DD-HH? I cant
use 'if' in the location i am trying this.

-- 

I know i can do: 
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
    set $year $1;
    set $month $2;
    set $day $3;
}

or with perl regex: 
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})")
{
    set $year $1;
    set $month $2;
    set $day $3;
    set $hour $4;
    set $minutes $5;
    set $seconds $6;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254210,254210#msg-254210



More information about the nginx mailing list