ZF2 segmented route constraint regex
<p>I am working on a ZF2 application where I need a route like this:</p>

<pre><code>'storage-deliver' =&gt; array(
    'type' =&gt; 'Segment',
    'options' =&gt; array(
        'route' =&gt; '/storage/:uuid/:path',
        'constraints' =&gt; array(
            'uuid' =&gt; '[a-zA-Z0-9-]*',
            'path' =&gt; '[a-zA-Z0-9-_\./\+]*'
        ),
        'defaults' =&gt; array(
            'controller' =&gt; 'StorageController',
            'action' =&gt; 'deliver',
        )
    )
)
</code></pre>

<p>The route should be able to match any route behind the <code>uuid</code> constraint.</p>

<p>Examples:</p>

<pre><code>/storage/0e529c8b-2403-40c1-a5bf-c6819e992079/some.file
/storage/0e529c8b-2403-40c1-a5bf-c6819e992079/an/undefined/depth/path/to/some.file
</code></pre>

<p>I know that the uuid constraint is not correct, but that is not relevant for my problem right now. Problem is the defined constraint <code>path</code>. It should be able to match whatever the rest of the given url looks like.</p>

<p>So far the given definition <code>[a-zA-Z0-9-_\./\+]*</code> works (at least for the examples I use), but I am pretty sure that there is a way to get that done in a much better way (and a way that truly matches all valid possibilities!).</p>

<p>Somewhere else here I found the following route example:</p>

<pre><code>/storage/:uuid/:path{-}
</code></pre>

<p>First everything was looking good, but <code>path</code> did not match in all cases.</p>

<p>Any help is welcome!</p>

<p>Thank you!</p>