From 95b356a939d7b05a3dd5c5c5f8acd565282caa75 Mon Sep 17 00:00:00 2001 From: Bergutov Ruslan Date: Mon, 12 Oct 2020 19:18:06 +0500 Subject: [PATCH] renamed --- README.md | 4 ++-- example_router_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 856e671..84b4adb 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The name mux stands for "HTTP request multiplexer". Like the standard `http.Serv * [Serving Single Page Applications](#serving-single-page-applications) (e.g. React, Vue, Ember.js, etc.) * [Registered URLs](#registered-urls) * [Walking Routes](#walking-routes) -* [Alias Pattern Registration](#pattern-registration) +* [Re-using Regular Expressions](#re-using-regular-expressions) * [Graceful Shutdown](#graceful-shutdown) * [Middleware](#middleware) * [Handling CORS Requests](#handling-cors-requests) @@ -436,7 +436,7 @@ func main() { } ``` -### Alias Pattern Registration +### Re-using Regular Expressions There can be a situation when you often need to specify some complex regular expressions inside your paths, e.g. uuid. This can be easily shorthanded: diff --git a/example_router_test.go b/example_router_test.go index c019430..a66ae5e 100644 --- a/example_router_test.go +++ b/example_router_test.go @@ -7,7 +7,7 @@ import ( ) // This example demonstrates alias pattern registration on router -func ExampleRouter_RegisterPattern() { +func ExampleRegisterPattern() { r := mux.NewRouter().RegisterPattern("uuid", "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}") route := r.Path("/category/{id:uuid}")