About Using Regexp in Nginx Map

The essence of the Nginx map directive is that it allows you to create a new variable whose value depends on the values of one or more of the source variables. The directive becomes even more efficient when regular expressions are used. However, one important point may be forgotten. Excerpt from the manual:

Since variables are evaluated only when they are used, the mere declaration even of a large number of map variables does not add any extra costs to request processing.