# Variables in if regexes

**URL:** <https://www.ruby-forum.com/t/variables-in-if-regexes/206426>\
**Category:** NGINX\
**Created:** [May 1, 2011, 3:04am UTC](https://www.ruby-forum.com/t/variables-in-if-regexes/206426 "2011-05-01T03:04:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 1, 2011, 3:04am UTC](https://www.ruby-forum.com/t/variables-in-if-regexes/206426/1 "2011-05-01T03:04:42Z")

</div>

I have a caching system I need to bypass if the logging in user’s name  
is found in the $request\_uri. I’m trying to do something like this, but  
can’t get the variable to interpolate into the regex. Any suggestions  
pretty please?

```
set $me "Asabouros.";
if ($uri ~ $me) { set $chk ""; }

```

I’ve always tried things like this:  
if ($uri ~ “by-{$me}”) { set $chk “”; }

Thanks!  
-Kevin

Posted at Nginx Forum:

> **[variables in if regexes](https://forum.nginx.org/read.php?2,194753,194753#msg-194753)**
>
> I have a caching system I need to bypass if the logging in user's name is found in the $request\_uri. I'm trying to do something like this, but can't get the variable to interpolate into the regex. Any suggestions pretty please? set $me...
