Regular Expressions 101

Community Library

Community Library Entry

0

Regular ExpressionOpen Workspace

/
^(?<m>[^\?]+)\?(?:.*)?
/
gm

Description
Created·2023-06-28 14:55
Type·Match
Flavor·PCRE2 (PHP)

Regular expression used to get the encoded URI portion of the $request_uri when unencoded $uri breaks a reverse proxy.

map $request_uri $request_uri_no_qs {
  "~^(?<m>[^\?]+)\?(?:.*)?"   $m;
  default                     $request_uri;
}
Submitted by jpatton@gmail.com
Open Workspace