Process Flow - Regex match (~, ~*)
Request URL Received
Check location blocks
Is location regex?
Match with ~ or ~*
If match found
Use this location
Process request
If no match
Try next location or default
Nginx checks request URLs against location blocks. If a location uses ~ or ~*, it tests the URL with regex (case-sensitive or insensitive). If matched, it uses that location.