# Traefik 2.0 , HostRegexp Routing unexpected effect each other

**URL:** <https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787>\
**Category:** Traefik v2\
**Tags:** file\
**Created:** [September 22, 2019, 7:16am UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787 "2019-09-22T07:16:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![einali](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/einali/32/1083_2.png) [@einali](https://community.traefik.io/u/einali)\
**Post date:** [September 22, 2019, 7:16am UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/1 "2019-09-22T07:16:43Z")

</div>

hi every one  
i think there is a bug in routing for hostregexp rule.  
i submitted an issue for it traefiker bot labeled it as question!!

[issue link](https://github.com/containous/traefik/issues/5443)

please someone take a look and inform me if i am wrong!  
thanks in advaced

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [September 22, 2019, 12:03pm UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/2 "2019-09-22T12:03:41Z")

</div>

Hello,

the HostRegexp syntax is:

```auto
HostRegexp(`{groupname:expression}`)"

```

```auto
HostRegexp(`{group:[a-z]+}.example.com`)

```

So when you write:

```auto
HostRegexp(`{localhssdost}`)"

```

it's just a just a group name without expression.

[https://docs.traefik.io/v2.0/routing/routers/#rule](https://docs.traefik.io/v2.0/routing/routers/#rule)

---

<div class="post-metadata">

**Author:** ![einali](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/einali/32/1083_2.png) [@einali](https://community.traefik.io/u/einali)\
**Post date:** [September 23, 2019, 8:39am UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/3 "2019-09-23T08:39:43Z")

</div>

Thank you so much.  
Sorry for not reading docs carefully!!

---

<div class="post-metadata">

**Author:** ![trond](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/trond/32/295_2.png) [@trond](https://community.traefik.io/u/trond)\
**Post date:** [November 8, 2019, 10:40am UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/4 "2019-11-08T10:40:38Z")

</div>

I dont get it. What does "group name" mean in this context?  
Given `HostRegexp(`{group:[a-z]+}.example.com`)`, could you give an example of both matching and non-matching hostnames? I'm really struggling to parse the documentation on this. I really wish Traefik made it easier to set up wildcard/subdomain matching without being a Go/Regex expert. A few lines of examples and explanation would go a long way.

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [November 8, 2019, 8:34pm UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/5 "2019-11-08T20:34:07Z")

</div>

I answered you in your other thread, but while confusion with unsed group name is understandable - I was wondering about that too when I first saw it, once that's cleared out, the rest I feel is clear.

This is standard Regex otherwise; go's dialect. You don't have to be Regex expert, you don't have use this particular rule at all if you are uncomfortable. But as anything in advanced technolgy traefik do rely on basic level of competence in its users. Regex is very wide-spread, well understood, and fit very well for what traefik is using it for.

Coplaining about usage of Regex with traefik is similar to compaining about usage of Regex with grep, e.g. does not make much sesnes.

I also do not feel that traefik documentation is the right place to teach users Regex, there are much better sources for that, and the documentation links one - the go's own Regex reference.

The bottom line - I'm happy to help with your struggling, but I feel it's unfair that your attribute your struggle with Regex to trafik documentation, I think that belongs elsewhere.

---

<div class="post-metadata">

**Author:** ![trond](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/trond/32/295_2.png) [@trond](https://community.traefik.io/u/trond)\
**Post date:** [November 11, 2019, 8:59am UTC](https://community.traefik.io/t/traefik-2-0-hostregexp-routing-unexpected-effect-each-other/1787/6 "2019-11-11T08:59:29Z")

</div>

Sorry, I didnt' mean it like that. I'll try and rephrase:

Looking at the "routers" documentation page ([https://docs.traefik.io/routing/routers/](https://docs.traefik.io/routing/routers/)):  
`Host` and `Path` rules have very clear and easy to understand examples:

 ![Screenshot%20from%202019-11-11%2009-55-15](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/4/4ceec6e96ae1614a9398e03da0c0358c5d52b740.png)

...and then HostRegexp (which is a far more complicated rule) only has:

 ![Screenshot%20from%202019-11-11%2009-56-05](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/e/efc99d71085758e9b5fc29620b0e9df6a52d6007.png)

IMHO this is not enough documentation to make it easy to understand what to do. My use case was a seemingly super-simple subdomain wildcard, and there was nothing in the documentation to help me - I had to do a mix of stackoverflow, regexp trial-and-error to get it done. Very frustrating. Granted, I'm not very proficient at regexp but even for an expert I would assume than better documentation would be welcome and allow users to solve tasks quicker.
