How to perform if condition for string with REGEX in nginx conf


I was trying to achieve for following url using nginx.

if such url requested contains string orgId then set some value to variable.

if such url requested contains string var-id then set another value to variable.

location /xyz/ {
if ($request_uri ~* “/xyz/.+?orgId”){
set $xyzuser TestingAuthUser1;
if ($request_uri ~* “/xyz/.+?orgId.+var-Id”){
set $xyzuser TestingAuthUser2;
proxy_set_header X-WEBAUTH-USER “${xyzuser}”;

How can I achieve this scenario in nginx. Please suggest.