From 49384403672a05ce89de12e1f6703a8e3ede3a6c Mon Sep 17 00:00:00 2001 From: david-perez Date: Fri, 29 Oct 2021 15:28:25 +0200 Subject: [PATCH] docs: greedy labels in URI patterns match greedily Specify that greedy labels in URI patterns match greedily, like in regular expressions: they will match the longest possible string. Add an example showing this behavior. --- docs/source/1.0/spec/core/http-traits.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/1.0/spec/core/http-traits.rst b/docs/source/1.0/spec/core/http-traits.rst index a10a9c91791..e55142ff699 100644 --- a/docs/source/1.0/spec/core/http-traits.rst +++ b/docs/source/1.0/spec/core/http-traits.rst @@ -378,7 +378,8 @@ Greedy matching can be used to capture the whole URI to a label, which results in every request for a particular HTTP method being captured. For example, this can be modeled with a pattern of ``/{label+}``. -Segments in the middle of a URI can be captured using greedy labels. Given a +Segments in the middle of a URI can be captured using greedy labels. Greedy +labels match greedily: they will match the longest possible string. Given a pattern of ``/prefix/{label+}/suffix`` and an endpoint of ``https://yourhost``: .. list-table:: @@ -403,6 +404,10 @@ pattern of ``/prefix/{label+}/suffix`` and an endpoint of ``https://yourhost``: * - ``http://yourhost/foo/bar/suffix`` - No - Does not match the literal "/prefix". + * - ``http://yourhost/prefix/foo/suffix/bar/suffix`` + - Yes + - Matches literal "/prefix", captures "foo/suffix/bar" in greedy + ``label``, and matches literal "/suffix". Pattern Validation and Conflict Avoidance