# Capture a group with brackets and re.group.{n}
if (req.url ~ "^/status/(\d+)") {
  log {"req.url ~ "^/status/(\d+)"   =>   "} + re.group.1;
}

# Non-capturing groups can be created by prefixing the
# bracketed expression with ?:
if (req.url ~ "^/(?:status|code)/(\d+)\?") {
  log {"req.url ~ "^/(?:status|code)/(\d+)\?"   =>   "} + re.group.1;
}

# Bracketed character class with [...]
if (req.url ~ "[?&]aaa=([^&]*)") {
  log {"req.url ~ "[?&]aaa=([^&]*)"   =>   "} + re.group.1;
}

# Specific repeat count with {min,max}
# Alternate options using (a|b)
if (req.url ~ "[\?&]a{2,6}=(foo|bar)(?:$|&)") {
  log {"req.url ~ "[\?&]a{2,6}=(foo|bar)(?:$|&)"   =>   "} + re.group.1;
}

# Make the match case insensitive using an (?i) prefix
if (req.url ~ "(?i)AaA=Foo") {
  log  {"req.url ~ "(?i)AaA=Foo"   =>   "} + re.group.0;
}

# Return a synthetic response, no need to query a backend here
error 200;