Skip to content

Commit

Permalink
docs: greedy labels in URI patterns match greedily
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
david-perez committed Oct 30, 2021
1 parent ef16a86 commit 4938440
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/source/1.0/spec/core/http-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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
Expand Down

0 comments on commit 4938440

Please sign in to comment.