# Re: Regular expression used in server\_name directive

**URL:** <https://www.ruby-forum.com/t/re-regular-expression-used-in-server-name-directive/227081>\
**Category:** NGINX\
**Created:** [March 3, 2013, 8:25pm UTC](https://www.ruby-forum.com/t/re-regular-expression-used-in-server-name-directive/227081 "2013-03-03T20:25:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2013, 8:25pm UTC](https://www.ruby-forum.com/t/re-regular-expression-used-in-server-name-directive/227081/1 "2013-03-03T20:25:13Z")

</div>

Just remove the part and it will act as only matching regex.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2013, 8:33pm UTC](https://www.ruby-forum.com/t/re-regular-expression-used-in-server-name-directive/227081/2 "2013-03-03T20:33:24Z")

</div>

I need a variable set that I use in the rest of the server {} block.

Posted at Nginx Forum:

> **[Re: Regular expression used in server\_name directive](https://forum.nginx.org/read.php?2,236870,236878#msg-236878)**
>
> I am using a regular expression with a capture group in my server\_name directive. It looks like: server\_name (?\<account\>.+)\\.mydomain\\.com$ The problem is that I want to expand it slightly and say anything except web3.mydomain.com. I.E. somet
