Understanding HAProxy map_reg Backend Matching Order and Default Route Behavior

I don’t understand how the matching order works with map_reg and base

use_backend %[base,map_reg(/usr/local/etc/haproxy/backend.map)]

This always matches backend-site

example\.com\/shop backend-shop
example\.com\/blog backend-blog
example\.com backend-site

This too

example\.com backend-site
example\.com\/shop backend-shop
example\.com\/blog backend-blog

The only solution I’ve found is

example\.com(?!\/(?:shop|blog)) backend-site

But this looks really tricky.

Am I doing something wrong? Is there a correct way to do this?

This should normally do (ordered from most precise to general regexp), which version are you using?