The last time I looked at nginx it parsed the HTTP request with a hand-coded state machine but routes that are defined by regular expression matching were handled one expression at a time.
Routes that are not defined by regular expressions used a much faster tree based method.
Routes that are not defined by regular expressions used a much faster tree based method.