Repository: gofiber/fiber
Pull request #2059 (2022-08-29 19:23:42)

:bug: bug: fix regex constraints
## Description
It was causing regex matching problem to remove `\` chars from regex constraint data for regex matchers like `\\d{4}-\\d{2}-\\d{2}`. To fix this, we don't remove escape chars for regex parameters. Also we no longer need to add escape chars before routing-specific characters for regex constraints.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation - https://github.com/gofiber/docs for https://docs.gofiber.io/
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I tried to make my code as fast as possible with as few allocations as possible
- [x] For new code I have written benchmarks so that they can be analyzed and improved

## Commit formatting:

Use emojis on commit messages so it provides an easy way of identifying the purpose or intention of a commit. Check out the emoji cheatsheet here: https://gitmoji.carloscuesta.me/



Patch:
diff --git a/.github/README.md b/.github/README.md
index 85406ea9..c0498264 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -595,13 +595,14 @@ func main() {
 Here is a list of middleware that are included within the Fiber framework.
 
 | Middleware                                                                             | Description                                                                                                                                                                  |
-| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+|:---------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth)         | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials.        |
 | [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache)                 | Intercept and cache responses                                                                                                                                                |
 | [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress)           | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default.                                                                                     |
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_ckb.md b/.github/README_ckb.md
index 8fd7ae8d..1f1bfd36 100644
--- a/.github/README_ckb.md
+++ b/.github/README_ckb.md
@@ -601,6 +601,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_de.md b/.github/README_de.md
index 8964567e..083fb17a 100644
--- a/.github/README_de.md
+++ b/.github/README_de.md
@@ -571,6 +571,7 @@ Hier finden Sie eine Liste der Middleware, die im Fiber-Framework enthalten ist.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_es.md b/.github/README_es.md
index 29416f26..1803de9f 100644
--- a/.github/README_es.md
+++ b/.github/README_es.md
@@ -571,6 +571,7 @@ Aquí está una lista del middleware incluido en el marco web Fiber.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_fa.md b/.github/README_fa.md
index 90332c3c..fb555ed4 100644
--- a/.github/README_fa.md
+++ b/.github/README_fa.md
@@ -686,6 +686,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   |فعال سازی هدر های cross-origin با گزینه های مختلف.|
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   |در برابر حملات CSRF ایمنی ایجاد میکند.|
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) |مقادیر کوکی هارا رمزنگاری میکند.|
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | با ارائه تنظیمات اختیاری، متغیرهای محیط را در معرض دید قرار دهید.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | میدلور ETag به کش ها اجازه میدهد کارآمد تر عمل کرده و در پهنای باند صرفه جویی کنند.  به عنوان یک وب سرور نیازی به دادن پاسخ کامل نیست اگر محتوا تغییر نکرده باشد. |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | میدلور Expvar میتواند متغیر هایی را تعریف کرده و مقادیر انها را در زمان اجرا با فرمت JSON به شما نشان دهد. |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | جلوگیری و یا کش کردن درخواست های favicon در صورتی که مسیر یک فایل را داده باشید.|
diff --git a/.github/README_fr.md b/.github/README_fr.md
index ebb24e34..b2fc3732 100644
--- a/.github/README_fr.md
+++ b/.github/README_fr.md
@@ -573,6 +573,7 @@ Here is a list of middleware that are included within the Fiber framework.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_he.md b/.github/README_he.md
index c6870387..7b19957e 100644
--- a/.github/README_he.md
+++ b/.github/README_he.md
@@ -689,6 +689,7 @@ Here is a list of middleware that are included within the Fiber framework.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_id.md b/.github/README_id.md
index 6e3e41c5..285644b8 100644
--- a/.github/README_id.md
+++ b/.github/README_id.md
@@ -574,6 +574,7 @@ Kumpulan `middleware` yang ada didalam kerangka kerja Fiber.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_it.md b/.github/README_it.md
index a07aa84d..b2e6307a 100644
--- a/.github/README_it.md
+++ b/.github/README_it.md
@@ -589,28 +589,29 @@ func main() {
 
 Qui una lista dei middleware inclusi con Fiber.
 
-| Middleware                                                                             | Descrizione                                                                                                                                                                  |
-| :------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth)         | Middleware basico di autenticazione usando http. Chiama il suo handler se le credenziali sono guiste e il codice 401 Unauthorized per credenziali mancanti o invailde.        |
-| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache)                 | Intercetta e mette nella cache la risposta                                                                                                                                                |
-| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress)           | Middlewere di compressione per Fiber, supporta `deflate`, `gzip` e `brotli` di default.                                                                                     |
+| Middleware                                                                             | Descrizione                                                                                                                                                                              |
+| :------------------------------------------------------------------------------------- |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth)         | Middleware basico di autenticazione usando http. Chiama il suo handler se le credenziali sono guiste e il codice 401 Unauthorized per credenziali mancanti o invailde.                   |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache)                 | Intercetta e mette nella cache la risposta                                                                                                                                               |
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress)           | Middlewere di compressione per Fiber, supporta `deflate`, `gzip` e `brotli` di default.                                                                                                  |
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Ti permette di usare cross-origin resource sharing \(CORS\) con tante optzioni.                                                                                                          |
-| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Ti protegge da attachi CSRF.                                                                                                                                                  |
-| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Middleware che encrypta i valori dei cookie.                                                                                                                             |
-| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | Middlewere che permette alle cache di essere piu efficienti e salvare banda, come un web server non deve rimandare il messagio pieno se il contenuto non è cambiato.               |
-| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Middleware che serve via il suo runtime server HTTP varianti esposte in formato JSON.                                                                               |
-| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignora favicon dai logs o serve dalla memoria se un filepath si dà.                                                                                                    |
-| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem)       | Middleware per il FileSystem per Fiber, grazie tante e crediti a Alireza Salary                                                                                                |
-| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter)             | Middelwere per Rate-limiting per Fiber. Usato per limitare richieste continue agli APIs publici e/o endpoints come un password reset.                                                   |
-| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger)               | Logger HTTP per richiesta/risposta.                                                                                                                                                |
-| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor)             | Middleware per monitorare che riporta metriche server, ispirato da express-status-monitor                                                                                           |
-| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof)                 | Grazie tante a Matthew Lee \(@mthli\)                                                                                                                                     |
-| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy)                 | Ti permette di fare richieste proxy a multipli server.                                                                                                                           |
-| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover)             | Middleware per recuperare dai attachi di panico da tutte le parti nella stack chain e da il controllo al centralizzato[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
-| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid)         | Aggiunge un requestid a ogni richiesta.                                                                                                                                           |
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Ti protegge da attachi CSRF.                                                                                                                                                             |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Middleware che encrypta i valori dei cookie.                                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Esporre le variabili di ambiente fornendo una configurazione facoltativa.                                                                                                                |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | Middlewere che permette alle cache di essere piu efficienti e salvare banda, come un web server non deve rimandare il messagio pieno se il contenuto non è cambiato.                     |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Middleware che serve via il suo runtime server HTTP varianti esposte in formato JSON.                                                                                                    |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignora favicon dai logs o serve dalla memoria se un filepath si dà.                                                                                                                      |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem)       | Middleware per il FileSystem per Fiber, grazie tante e crediti a Alireza Salary                                                                                                          |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter)             | Middelwere per Rate-limiting per Fiber. Usato per limitare richieste continue agli APIs publici e/o endpoints come un password reset.                                                    |
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger)               | Logger HTTP per richiesta/risposta.                                                                                                                                                      |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor)             | Middleware per monitorare che riporta metriche server, ispirato da express-status-monitor                                                                                                |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof)                 | Grazie tante a Matthew Lee \(@mthli\)                                                                                                                                                    |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy)                 | Ti permette di fare richieste proxy a multipli server.                                                                                                                                   |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover)             | Middleware per recuperare dai attachi di panico da tutte le parti nella stack chain e da il controllo al centralizzato[ ErrorHandler](https://docs.gofiber.io/guide/error-handling).     |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid)         | Aggiunge un requestid a ogni richiesta.                                                                                                                                                  |
 | [session](https://github.com/gofiber/fiber/tree/master/middleware/session)             | Middelwere per sessioni. NOTA: Questo middleware usa il nostro Storage package.                                                                                                          |
-| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip)                   | Middleware che salta un wrapped handler se un predicate è vero.                                                                                                         |
-| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout)             | Aggiunge un tempo massimo per una richiesta e lo manda a ErrorHandler se si supera.                                                                                                |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip)                   | Middleware che salta un wrapped handler se un predicate è vero.                                                                                                                          |
+| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout)             | Aggiunge un tempo massimo per una richiesta e lo manda a ErrorHandler se si supera.                                                                                                      |
 
 ## 🧬 Middleware Esterni
 
diff --git a/.github/README_ja.md b/.github/README_ja.md
index 6d2cda52..8243b292 100644
--- a/.github/README_ja.md
+++ b/.github/README_ja.md
@@ -576,6 +576,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_ko.md b/.github/README_ko.md
index 6b4ba34f..00cea280 100644
--- a/.github/README_ko.md
+++ b/.github/README_ko.md
@@ -577,6 +577,7 @@ Fiber 프레임워크에 포함되는 미들웨어 목록입니다.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_nl.md b/.github/README_nl.md
index d7ffd4da..000a3787 100644
--- a/.github/README_nl.md
+++ b/.github/README_nl.md
@@ -577,6 +577,7 @@ Here is a list of middleware that are included within the Fiber framework.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_pt.md b/.github/README_pt.md
index f15f4e3a..0079eb63 100644
--- a/.github/README_pt.md
+++ b/.github/README_pt.md
@@ -571,6 +571,7 @@ Here is a list of middleware that are included within the Fiber framework.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_ru.md b/.github/README_ru.md
index eaa171ee..12cd17cf 100644
--- a/.github/README_ru.md
+++ b/.github/README_ru.md
@@ -578,6 +578,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_sa.md b/.github/README_sa.md
index 6e90ca81..b3655d8d 100644
--- a/.github/README_sa.md
+++ b/.github/README_sa.md
@@ -642,6 +642,7 @@ Here is a list of middleware that are included within the Fiber framework.
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Enable cross-origin resource sharing \(CORS\) with various options.                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | Protect from CSRF exploits.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Ignore favicon from logs or serve from memory if a file path is provided.                                                                                                    |
diff --git a/.github/README_tr.md b/.github/README_tr.md
index 3866ff7c..7f53a7f7 100644
--- a/.github/README_tr.md
+++ b/.github/README_tr.md
@@ -564,26 +564,27 @@ func main() {
 Fiber'a dahil edilen middlewareların bir listesi aşağıda verilmiştir.
 
 | Middleware                                                                             | Açıklama                                                                                                                                                                               |
-| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| :------------------------------------------------------------------------------------- |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth)         | Basic auth middleware'ı, bir HTTP Basic auth sağlar. Geçerli kimlik bilgileri için sonraki handlerı ve eksik veya geçersiz kimlik bilgileri için 401 döndürür.                         |
-| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache)                 | Reponseları durdur ve önbelleğe al.                                                                                                                                                     |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache)                 | Reponseları durdur ve önbelleğe al.                                                                                                                                                    |
 | [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress)           | Fiber için sıkıştırma middleware, varsayılan olarak `deflate`, `gzip` ve `brotli`yi destekler.                                                                                         |
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)                   | Çeşitli seçeneklerle başlangıçlar arası kaynak paylaşımını \(CORS\) etkinleştirin.                                                                                                     |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)                   | CSRF exploitlerinden korunun.                                                                                                                                                          |
-| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware'ı cookie değerlerini şifreler.                                                                                                                                       |
-| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware'ı sayfa içeriği değişmediyse bant genişliğini daha verimli kullanmak için tam sayfa içeriğini tekrar göndermez.                         |
-| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware, HTTP serverinin bazı runtime değişkenlerini JSON formatında sunar.                                                                                        |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware'ı cookie değerlerini şifreler.                                                                                                                                      |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Environment değişkenlerini belirtilen ayarlara göre dışarıya açar.                                                                                                                     |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware'ı sayfa içeriği değişmediyse bant genişliğini daha verimli kullanmak için tam sayfa içeriğini tekrar göndermez.                                                        |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware, HTTP serverinin bazı runtime değişkenlerini JSON formatında sunar.                                                                                                  |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)             | Bir dosya yolu sağlanmışsa, loglardaki favicon'u yoksayar veya bellekten sunar.                                                                                                        |
-| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem)       | Fiber için FileSystem middleware, Alireza Salary'e özel teşekkürler.                                                                                                                    |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem)       | Fiber için FileSystem middleware, Alireza Salary'e özel teşekkürler.                                                                                                                   |
 | [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter)             | Fiber için hız sınırlayıcı middleware'i. Açık API'lere ve/veya parola sıfırlama gibi endpointlere yönelik tekrarlanan istekleri sınırlamak için kullanın.                              |
 | [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger)               | HTTP istek/yanıt logger'ı.                                                                                                                                                             |
-| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor)             | Monitor middleware'ı sunucu metriklerini rapor eder, express-status-monitor'den esinlenildi.                                                                                                     |
-| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof)                 | Matthew Lee'ye özel teşekkürler \(@mthli\).                                                                                                                                             |
-| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy)                 | Birden çok sunucuya proxy istekleri yapmanızı sağlar.                                                                                                                                   |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor)             | Monitor middleware'ı sunucu metriklerini rapor eder, express-status-monitor'den esinlenildi.                                                                                           |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof)                 | Matthew Lee'ye özel teşekkürler \(@mthli\).                                                                                                                                            |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy)                 | Birden çok sunucuya proxy istekleri yapmanızı sağlar.                                                                                                                                  |
 | [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover)             | Recover middleware'i, stack chain'ini herhangi bir yerindeki paniklerden kurtulur ve kontrolü merkezileştirilmiş [ErrorHandler'e](https://docs.gofiber.io/guide/error-handling) verir. |
-| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid)         | Her requeste id verir.                                                                                                                                                                  |
-| [session](https://github.com/gofiber/fiber/tree/master/middleware/session)             | Session için middleware. NOTE: Bu middleware Fiber'in Storage yapısını kullanır.                                                                                                                    |
-| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip)                   | Skip middleware'ı verilen koşul `true` olduğunda handler'ı atlar ve işlemez.                                                                                                                   |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid)         | Her requeste id verir.                                                                                                                                                                 |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session)             | Session için middleware. NOTE: Bu middleware Fiber'in Storage yapısını kullanır.                                                                                                       |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip)                   | Skip middleware'ı verilen koşul `true` olduğunda handler'ı atlar ve işlemez.                                                                                                           |
 | [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout)             | Bir request için maksimum süre ekler ve aşılırsa ErrorHandler'a iletir.                                                                                                                |
 
 ## 🧬 Harici Middlewarelar
diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md
index 5369548a..b78811e8 100644
--- a/.github/README_zh-CN.md
+++ b/.github/README_zh-CN.md
@@ -573,6 +573,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)             | 使用各种选项启用跨源资源共享\(CORS\).                                                                                                          |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)             | 保护来自CSRF的漏洞.                                                                                                                                                  |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | 加密 cookie 值的加密中间件.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | 通过提供可选配置来公开环境变量。.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | 让缓存更加高效并且节省带宽,让web服务不再需要重新响应整个响应体如果响应内容未变更.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | 通过其HTTP服务器运行时间提供JSON格式的暴露变体.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)       | 如果提供了文件路径，则忽略日志中的图标或从内存中服务.                                                                                                    |
diff --git a/.github/README_zh-TW.md b/.github/README_zh-TW.md
index 1d3907cb..a7f2dfe8 100644
--- a/.github/README_zh-TW.md
+++ b/.github/README_zh-TW.md
@@ -573,6 +573,7 @@ func main() {
 | [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors)             | 使用各種選項啟用跨域資源共享 \(CORS\)。                                                                                  |
 | [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf)             | 防止 CSRF 漏洞利用。                                                                                                                          |
 | [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values.                                                                                                                             |
+| [envvar](https://github.com/gofiber/fiber/tree/master/middleware/envvar)               | Expose environment variables with providing an optional config.                                                                                                              |
 | [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag)                   | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.               |
 | [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar)               | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format.                                                                               |
 | [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon)       | 如果提供了文件路徑，則忽略日誌中的網站圖標或從內存中提供服務。                                                                                                    |
diff --git a/middleware/envvar/README.md b/middleware/envvar/README.md
new file mode 100644
index 00000000..b9880e9c
--- /dev/null
+++ b/middleware/envvar/README.md
@@ -0,0 +1,83 @@
+# Exposing Environment Variables Middleware
+
+EnvVar middleware for [Fiber](https://github.com/gofiber/fiber) that can be used to expose environment variables with various options.
+
+## Table of Contents
+
+- [Environment Variables (EnvVar) Middleware](#environment-variables-envvar-middleware)
+    - [Table of Contents](#table-of-contents)
+    - [Signatures](#signatures)
+    - [Examples](#examples)
+        - [Default Config](#default-config)
+        - [Custom Config](#custom-config)
+        - [Response](#response)
+    - [Config](#config)
+    - [Default Config](#default-config-1)
+
+## Signatures
+
+```go
+func New(config ...Config) fiber.Handler
+```
+
+## Examples
+
+First import the middleware from Fiber,
+
+```go
+import (
+  "github.com/gofiber/fiber/v2"
+  "github.com/gofiber/fiber/v2/middleware/envvar"
+)
+```
+
+Then create a Fiber app with `app := fiber.New()`.
+
+**Note**: You need to provide a path to use envvar middleware.
+
+### Default Config
+
+```go
+app.Use("/expose/envvars", envvar.New())
+```
+
+### Custom Config
+
+```go
+app.Use("/expose/envvars", envvar.New(envvar.Config{
+    ExportVars:  map[string]string{"testKey": "", "testDefaultKey": "testDefaultVal"},
+    ExcludeVars: map[string]string{"excludeKey": ""}}
+}))
+```
+
+### Response
+
+Http response contract:
+```
+{
+  "vars": {
+    "someEnvVariable": "someValue",
+    "anotherEnvVariable": "anotherValue",
+  }
+}
+
+```
+
+## Config
+
+```go
+// Config defines the config for middleware.
+type Config struct {
+    // ExportVars specifies the environment variables that should export
+    ExportVars map[string]string
+    // ExcludeVars specifies the environment variables that should not export
+    ExcludeVars map[string]string
+}
+
+```
+
+## Default Config
+
+```go
+Config{}
+```
diff --git a/middleware/envvar/envvar.go b/middleware/envvar/envvar.go
new file mode 100644
index 00000000..373eac50
--- /dev/null
+++ b/middleware/envvar/envvar.go
@@ -0,0 +1,73 @@
+package envvar
+
+import (
+	"github.com/gofiber/fiber/v2"
+	"github.com/gofiber/fiber/v2/utils"
+	"os"
+	"strings"
+)
+
+// Config defines the config for middleware.
+type Config struct {
+	// ExportVars specifies the environment variables that should export
+	ExportVars map[string]string
+	// ExcludeVars specifies the environment variables that should not export
+	ExcludeVars map[string]string
+}
+
+type EnvVar struct {
+	Vars map[string]string `json:"vars"`
+}
+
+func (envVar *EnvVar) set(key, val string) {
+	envVar.Vars[key] = val
+}
+
+var defaultConfig = Config{}
+
+func New(config ...Config) fiber.Handler {
+	var cfg = defaultConfig
+	if len(config) > 0 {
+		cfg = config[0]
+	}
+
+	return func(c *fiber.Ctx) error {
+		if c.Method() != fiber.MethodGet {
+			return fiber.ErrMethodNotAllowed
+		}
+
+		envVar := newEnvVar(cfg)
+		varsByte, err := c.App().Config().JSONEncoder(envVar)
+		if err != nil {
+			c.Response().SetBodyRaw(utils.UnsafeBytes(err.Error()))
+			c.Response().SetStatusCode(fiber.StatusInternalServerError)
+			return nil
+		}
+		c.Response().SetBodyRaw(varsByte)
+		c.Response().SetStatusCode(fiber.StatusOK)
+		c.Response().Header.Set("Content-Type", "application/json; charset=utf-8")
+		return nil
+	}
+}
+
+func newEnvVar(cfg Config) *EnvVar {
+	vars := &EnvVar{Vars: make(map[string]string)}
+
+	if len(cfg.ExportVars) > 0 {
+		for key, defaultVal := range cfg.ExportVars {
+			vars.set(key, defaultVal)
+			if envVal, exists := os.LookupEnv(key); exists {
+				vars.set(key, envVal)
+			}
+		}
+	} else {
+		for _, envVal := range os.Environ() {
+			keyVal := strings.Split(envVal, "=")
+			if _, exists := cfg.ExcludeVars[keyVal[0]]; !exists {
+				vars.set(keyVal[0], keyVal[1])
+			}
+		}
+	}
+
+	return vars
+}
diff --git a/path.go b/path.go
index db2818dd..2b9e0e45 100644
--- a/path.go
+++ b/path.go
@@ -7,7 +7,6 @@
 package fiber
 
 import (
-	"fmt"
 	"regexp"
 	"strconv"
 	"strings"
@@ -250,7 +249,7 @@ func (routeParser *routeParser) analyseParameterPart(pattern string) (string, *r
 	// find constraint part if exists in the parameter part and remove it
 	if parameterEndPosition > 0 {
 		parameterConstraintStart = findNextNonEscapedCharsetPosition(pattern[0:parameterEndPosition], parameterConstraintStartChars)
-		parameterConstraintEnd = findNextNonEscapedCharsetPosition(pattern[0:parameterEndPosition+1], parameterConstraintEndChars)
+		parameterConstraintEnd = findLastCharsetPosition(pattern[0:parameterEndPosition+1], parameterConstraintEndChars)
 	}
 
 	// cut params part
@@ -262,12 +261,12 @@ func (routeParser *routeParser) analyseParameterPart(pattern string) (string, *r
 
 	if hasConstraint := (parameterConstraintStart != -1 && parameterConstraintEnd != -1); hasConstraint {
 		constraintString := pattern[parameterConstraintStart+1 : parameterConstraintEnd]
-		userconstraints := splitNonEscaped(constraintString, string(parameterConstraintSeparatorChars))
-		constraints = make([]*Constraint, 0, len(userconstraints))
+		userConstraints := splitNonEscaped(constraintString, string(parameterConstraintSeparatorChars))
+		constraints = make([]*Constraint, 0, len(userConstraints))
 
-		for _, c := range userconstraints {
+		for _, c := range userConstraints {
 			start := findNextNonEscapedCharsetPosition(c, parameterConstraintDataStartChars)
-			end := findNextNonEscapedCharsetPosition(c, parameterConstraintDataEndChars)
+			end := findLastCharsetPosition(c, parameterConstraintDataEndChars)
 
 			// Assign constraint
 			if start != -1 && end != -1 {
@@ -277,11 +276,13 @@ func (routeParser *routeParser) analyseParameterPart(pattern string) (string, *r
 				}
 
 				// remove escapes from data
-				if len(constraint.Data) == 1 {
-					constraint.Data[0] = RemoveEscapeChar(constraint.Data[0])
-				} else if len(constraint.Data) == 2 {
-					constraint.Data[0] = RemoveEscapeChar(constraint.Data[0])
-					constraint.Data[1] = RemoveEscapeChar(constraint.Data[1])
+				if constraint.ID != regexConstraint {
+					if len(constraint.Data) == 1 {
+						constraint.Data[0] = RemoveEscapeChar(constraint.Data[0])
+					} else if len(constraint.Data) == 2 {
+						constraint.Data[0] = RemoveEscapeChar(constraint.Data[0])
+						constraint.Data[1] = RemoveEscapeChar(constraint.Data[1])
+					}
 				}
 
 				// Precompile regex if has regex constraint
@@ -346,6 +347,18 @@ func findNextCharsetPosition(search string, charset []byte) int {
 	return nextPosition
 }
 
+// findNextCharsetPosition search the last char position from the charset
+func findLastCharsetPosition(search string, charset []byte) int {
+	lastPosition := -1
+	for _, char := range charset {
+		if pos := strings.LastIndexByte(search, char); pos != -1 && (pos < lastPosition || lastPosition == -1) {
+			lastPosition = pos
+		}
+	}
+
+	return lastPosition
+}
+
 // findNextCharsetPositionConstraint search the next char position from the charset
 // unlike findNextCharsetPosition, it takes care of constraint start-end chars to parse route pattern
 func findNextCharsetPositionConstraint(search string, charset []byte) int {
@@ -363,7 +376,7 @@ func findNextCharsetPositionConstraint(search string, charset []byte) int {
 		if char == paramConstraintEnd {
 			constraintEnd = pos
 		}
-		//fmt.Println(string(char))
+
 		if pos != -1 && (pos < nextPosition || nextPosition == -1) {
 			if pos > constraintStart && pos < constraintEnd {
 				nextPosition = pos
@@ -594,8 +607,6 @@ func (c *Constraint) CheckConstraint(param string) bool {
 		}
 	}
 
-	fmt.Print(c.Data)
-
 	// check constraints
 	switch c.ID {
 	case intConstraint:


Test patch:
diff --git a/listen_test.go b/listen_test.go
index 11d1908b..978e953a 100644
--- a/listen_test.go
+++ b/listen_test.go
@@ -166,12 +166,18 @@ func captureOutput(f func()) string {
 	go func() {
 		var buf bytes.Buffer
 		wg.Done()
-		io.Copy(&buf, reader)
+		_, err := io.Copy(&buf, reader)
+		if err != nil {
+			panic(err)
+		}
 		out <- buf.String()
 	}()
 	wg.Wait()
 	f()
-	writer.Close()
+	err = writer.Close()
+	if err != nil {
+		panic(err)
+	}
 	return <-out
 }
 
@@ -244,6 +250,6 @@ func Test_App_print_Route_with_group(t *testing.T) {
 	utils.AssertEqual(t, true, strings.Contains(printRoutesMessage, "/v1/test/fiber/*"))
 }
 
-func emptyHandler(c *Ctx) error {
+func emptyHandler(_ *Ctx) error {
 	return nil
 }
diff --git a/middleware/envvar/envvar_test.go b/middleware/envvar/envvar_test.go
new file mode 100644
index 00000000..edb74d5f
--- /dev/null
+++ b/middleware/envvar/envvar_test.go
@@ -0,0 +1,104 @@
+package envvar
+
+import (
+	"encoding/json"
+	"github.com/gofiber/fiber/v2"
+	"github.com/gofiber/fiber/v2/utils"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"testing"
+)
+
+func TestEnvVarStructWithExportVarsExcludeVars(t *testing.T) {
+	os.Setenv("testKey", "testEnvValue")
+	os.Setenv("anotherEnvKey", "anotherEnvVal")
+	os.Setenv("excludeKey", "excludeEnvValue")
+	defer os.Unsetenv("testKey")
+	defer os.Unsetenv("anotherEnvKey")
+	defer os.Unsetenv("excludeKey")
+
+	vars := newEnvVar(Config{
+		ExportVars:  map[string]string{"testKey": "", "testDefaultKey": "testDefaultVal"},
+		ExcludeVars: map[string]string{"excludeKey": ""}})
+
+	utils.AssertEqual(t, vars.Vars["testKey"], "testEnvValue")
+	utils.AssertEqual(t, vars.Vars["testDefaultKey"], "testDefaultVal")
+	utils.AssertEqual(t, vars.Vars["excludeKey"], "")
+	utils.AssertEqual(t, vars.Vars["anotherEnvKey"], "")
+}
+
+func TestEnvVarHandler(t *testing.T) {
+	os.Setenv("testKey", "testVal")
+	defer os.Unsetenv("testKey")
+
+	expectedEnvVarResponse, _ := json.Marshal(
+		struct {
+			Vars map[string]string `json:"vars"`
+		}{
+			map[string]string{"testKey": "testVal"},
+		})
+
+	app := fiber.New()
+	app.Use("/envvars", New(Config{
+		ExportVars: map[string]string{"testKey": ""}}))
+
+	req, _ := http.NewRequest("GET", "http://localhost/envvars", nil)
+	resp, err := app.Test(req)
+	utils.AssertEqual(t, nil, err)
+
+	respBody, err := ioutil.ReadAll(resp.Body)
+	utils.AssertEqual(t, nil, err)
+
+	utils.AssertEqual(t, expectedEnvVarResponse, respBody)
+}
+
+func TestEnvVarHandlerNotMatched(t *testing.T) {
+	app := fiber.New()
+	app.Use("/envvars", New(Config{
+		ExportVars: map[string]string{"testKey": ""}}))
+
+	app.Get("/another-path", func(ctx *fiber.Ctx) error {
+		ctx.SendString("OK")
+		return nil
+	})
+
+	req, _ := http.NewRequest("GET", "http://localhost/another-path", nil)
+	resp, err := app.Test(req)
+	utils.AssertEqual(t, nil, err)
+
+	respBody, err := ioutil.ReadAll(resp.Body)
+	utils.AssertEqual(t, nil, err)
+
+	utils.AssertEqual(t, []byte("OK"), respBody)
+}
+
+func TestEnvVarHandlerDefaultConfig(t *testing.T) {
+	os.Setenv("testEnvKey", "testEnvVal")
+	defer os.Unsetenv("testEnvKey")
+
+	app := fiber.New()
+	app.Use("/envvars", New())
+
+	req, _ := http.NewRequest("GET", "http://localhost/envvars", nil)
+	resp, err := app.Test(req)
+	utils.AssertEqual(t, nil, err)
+
+	respBody, err := ioutil.ReadAll(resp.Body)
+	utils.AssertEqual(t, nil, err)
+
+	var envVars EnvVar
+	utils.AssertEqual(t, nil, json.Unmarshal(respBody, &envVars))
+	val := envVars.Vars["testEnvKey"]
+	utils.AssertEqual(t, "testEnvVal", val)
+}
+
+func TestEnvVarHandlerMethod(t *testing.T) {
+	app := fiber.New()
+	app.Use("/envvars", New())
+
+	req, _ := http.NewRequest("POST", "http://localhost/envvars", nil)
+	resp, err := app.Test(req)
+	utils.AssertEqual(t, nil, err)
+	utils.AssertEqual(t, fiber.StatusMethodNotAllowed, resp.StatusCode)
+}
diff --git a/path_test.go b/path_test.go
index 4ea2a1ec..ca02ea2b 100644
--- a/path_test.go
+++ b/path_test.go
@@ -520,12 +520,18 @@ func Test_Path_matchParams(t *testing.T) {
 		{url: "/api/v1/8728382", params: []string{"8728382"}, match: false},
 		{url: "/api/v1/2005-11-01", params: []string{"2005-11-01"}, match: true},
 	})
-	testCase("/api/v1/:param<regex(p\\([a\\-z]\\+\\)ch)>", []testparams{
+	testCase("/api/v1/:param<regex(p([a-z]+)ch)>", []testparams{
 		{url: "/api/v1/ent", params: []string{"ent"}, match: false},
 		{url: "/api/v1/15", params: []string{"15"}, match: false},
 		{url: "/api/v1/peach", params: []string{"peach"}, match: true},
 		{url: "/api/v1/p34ch", params: []string{"p34ch"}, match: false},
 	})
+	testCase("/api/v1/:param<regex(\\d{4}-\\d{2}-\\d{2})}>", []testparams{
+		{url: "/api/v1/ent", params: []string{"ent"}, match: false},
+		{url: "/api/v1/15", params: []string{"15"}, match: false},
+		{url: "/api/v1/2022-08-27", params: []string{"2022-08-27"}, match: true},
+		{url: "/api/v1/2022/08-27", params: []string{"p34ch"}, match: false},
+	})
 	testCase("/api/v1/:param<int;bool((>", []testparams{
 		{url: "/api/v1/entity", params: []string{"entity"}, match: false},
 		{url: "/api/v1/8728382", params: []string{"8728382"}, match: true},
@@ -739,12 +745,18 @@ func Benchmark_Path_matchParams(t *testing.B) {
 		{url: "/api/v1/8728382", params: []string{"8728382"}, match: false},
 		{url: "/api/v1/2005-11-01", params: []string{"2005-11-01"}, match: true},
 	})
-	benchCase("/api/v1/:param<regex(p\\([a\\-z]\\+\\)ch)>", []testparams{
+	benchCase("/api/v1/:param<regex(p([a-z]+)ch)>", []testparams{
 		{url: "/api/v1/ent", params: []string{"ent"}, match: false},
 		{url: "/api/v1/15", params: []string{"15"}, match: false},
 		{url: "/api/v1/peach", params: []string{"peach"}, match: true},
 		{url: "/api/v1/p34ch", params: []string{"p34ch"}, match: false},
 	})
+	benchCase("/api/v1/:param<regex(\\d{4}-\\d{2}-\\d{2})}>", []testparams{
+		{url: "/api/v1/ent", params: []string{"ent"}, match: false},
+		{url: "/api/v1/15", params: []string{"15"}, match: false},
+		{url: "/api/v1/2022-08-27", params: []string{"2022-08-27"}, match: true},
+		{url: "/api/v1/2022/08-27", params: []string{"p34ch"}, match: false},
+	})
 	benchCase("/api/v1/:param<int;bool((>", []testparams{
 		{url: "/api/v1/entity", params: []string{"entity"}, match: false},
 		{url: "/api/v1/8728382", params: []string{"8728382"}, match: true},