# Router Path substring

**URL:** <https://community.traefik.io/t/router-path-substring/3538>\
**Category:** Traefik v2\
**Tags:** middleware\
**Created:** [December 20, 2019, 4:11pm UTC](https://community.traefik.io/t/router-path-substring/3538 "2019-12-20T16:11:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![suxarik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/suxarik/32/1918_2.png) [@suxarik](https://community.traefik.io/u/suxarik)\
**Post date:** [December 20, 2019, 4:11pm UTC](https://community.traefik.io/t/router-path-substring/3538/1 "2019-12-20T16:11:53Z")

</div>

I cant seem to find a way to use regexp in router-PathPrefix to allow routing based on substring value. It's ok if I know exact url like domain.con\path\*_someID_\*  
But I have applications that can have this **someID** in different places like [domain.com/request/](http://domain.com/request/) **someID** or [domain.com/path/anotherpath/](http://domain.com/path/anotherpath/) **someID**  
Is there a way to substring that value, not knowing it's exact position relative to root path?  
I tried:

```auto
PathPrefix(`{something}/someID/{else}`)

```

or as simple as

```auto
PathPrefix(`*/someID/*`)

```

None works.  
Would appreciate any help.

---

<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:** [December 20, 2019, 6:01pm UTC](https://community.traefik.io/t/router-path-substring/3538/2 "2019-12-20T18:01:10Z")

</div>

Hello,

```auto
PathPrefix(`{something:.+}/someID/{else:.+}`)

```

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

---

<div class="post-metadata">

**Author:** ![agimenez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/agimenez/32/987_2.png) [@agimenez](https://community.traefik.io/u/agimenez)\
**Post date:** [April 15, 2020, 12:07pm UTC](https://community.traefik.io/t/router-path-substring/3538/3 "2020-04-15T12:07:35Z")

</div>

Hi! one question, in the [rule docs](https://docs.traefik.io/v2.0/routing/routers/#rule) there's this example:

```auto
PathPrefix(`/products/`, `/articles/{category}/{id:[0-9]+}`)

```

I couldn't find what exactly does the `{category}` bit do. Is it a special regex? is it just an example thact actually does nothing?

---

<div class="post-metadata">

**Author:** ![suxarik](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/suxarik/32/1918_2.png) [@suxarik](https://community.traefik.io/u/suxarik)\
**Post date:** [April 15, 2020, 1:06pm UTC](https://community.traefik.io/t/router-path-substring/3538/4 "2020-04-15T13:06:14Z")

</div>

If I'm correct {category} is just a placeholder meaning {something\_must\_be\_here}

---

<div class="post-metadata">

**Author:** ![agimenez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/agimenez/32/987_2.png) [@agimenez](https://community.traefik.io/u/agimenez)\
**Post date:** [April 15, 2020, 2:39pm UTC](https://community.traefik.io/t/router-path-substring/3538/5 "2020-04-15T14:39:59Z")

</div>

I understand. However, I wonder if that is an actual valid regexp to put in a real configuration file. Otherwise, if that's just "stub", I think it may be misleading, and better use a real example instead, like in the other cases (e.g. "`PathPrefix(`/products/`, `/articles/{category:.*}/{id:[0-9]+}`)`".

I just want to clarify whether just writing `{category}` is equivalent to `{category:.*}`, or an invalid example.

Thanks

**EDIT:** It looks a bug in the docs, as latest version shows a correct regexp usage.
