Skip to content

Commit 4938440

Browse files
committed
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.
1 parent ef16a86 commit 4938440

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/source/1.0/spec/core/http-traits.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ Greedy matching can be used to capture the whole URI to a label, which results
378378
in every request for a particular HTTP method being captured. For example, this
379379
can be modeled with a pattern of ``/{label+}``.
380380

381-
Segments in the middle of a URI can be captured using greedy labels. Given a
381+
Segments in the middle of a URI can be captured using greedy labels. Greedy
382+
labels match greedily: they will match the longest possible string. Given a
382383
pattern of ``/prefix/{label+}/suffix`` and an endpoint of ``https://yourhost``:
383384

384385
.. list-table::
@@ -403,6 +404,10 @@ pattern of ``/prefix/{label+}/suffix`` and an endpoint of ``https://yourhost``:
403404
* - ``http://yourhost/foo/bar/suffix``
404405
- No
405406
- Does not match the literal "/prefix".
407+
* - ``http://yourhost/prefix/foo/suffix/bar/suffix``
408+
- Yes
409+
- Matches literal "/prefix", captures "foo/suffix/bar" in greedy
410+
``label``, and matches literal "/suffix".
406411

407412

408413
Pattern Validation and Conflict Avoidance

0 commit comments

Comments
 (0)