# Capture path regex wildcard to use in namespace

**URL:** <https://community.traefik.io/t/capture-path-regex-wildcard-to-use-in-namespace/27127>\
**Category:** Traefik v3 (latest)\
**Tags:** rest-api, kubernetes-ingress, plugin\
**Created:** [April 8, 2025, 9:33pm UTC](https://community.traefik.io/t/capture-path-regex-wildcard-to-use-in-namespace/27127 "2025-04-08T21:33:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterli](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@peterli](https://community.traefik.io/u/peterli)\
**Post date:** [April 8, 2025, 9:33pm UTC](https://community.traefik.io/t/capture-path-regex-wildcard-to-use-in-namespace/27127/1 "2025-04-08T21:33:03Z")

</div>

Hi,

I would like to capture path wildcard regex and use the capture in namespace...  
For example, /path/abc/... to route to namespace 'abc', service: web-server, i.e. web-server.abc. Generalized, this would be /path/(.\*) to web-server.$1 if using the $1 for first regex capture group. There are potentially more complex scenarios, i.e. multiple capture groups.

Is this possible ?  
Thanks ahead

---

<div class="post-metadata">

**Author:** ![markrity](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/markrity/32/9719_2.png) [@markrity](https://community.traefik.io/u/markrity)\
**Post date:** [April 8, 2025, 10:06pm UTC](https://community.traefik.io/t/capture-path-regex-wildcard-to-use-in-namespace/27127/2 "2025-04-08T22:06:28Z")

</div>

From what I have seen and tried , regex replace will work only on the `path` it self .

```yaml
      replacePathRegex:
        regex: "^/path/(.*)"
        replacement: "/$1"

```

I have tried to achieve something similar to your in past and found out that it was not possible.

In order to achieve what you want , I guess you will need to know all the `(.*)` in advance, in order to have them templated at your `service:` values.  
I guess if its not something that getting spinned-up on the go , you can achieve it by templating your `yamls`.
