Why does this route work with a slash and not a dash? I have defined a custom dynamic route that works, but isn't ideal:

/**
* Defines dynamic routes.
*/
class GuideUnitRoutes {

  /**
   * {@inheritdoc}
   */
  public function routes() {
    $route_collection = new RouteCollection();

    $route = new Route(
      "/guide_name/{guide_id}/{child}",
      [
        '_controller' =&gt; '\Drupal\guides\Controller\GuidesUnitController::view',
        '_title' =&gt; 'Hello',
      ],
      [
        'guide_id' =&gt; '\\w+',
        'child' =&gt; '\\w+',
        '_permission' =&gt; 'access content',
      ]
    );

    $route_collection-&gt;add("guide.child", $route);

    $route_collection-&gt;setMethods(['GET']);

    return $route_collection;
  }

}


If I define it to be ideal, it stops working:

/**
* Defines dynamic routes.
*/
class GuideUnitRoutes {

  /**
   * {@inheritdoc}
   */
  public function routes() {
    $route_collection = new RouteCollection();

    $route = new Route(
      "/guide_name-{guide_id}/{child}",
      [
        '_controller' =&gt; '\Drupal\guides\Controller\GuidesUnitController::view',
        '_title' =&gt; 'Hello',
      ],
      [
        'guide_id' =&gt; '\\w+',
        'child' =&gt; '\\w+',
        '_permission' =&gt; 'access content',
      ]
    );

    $route_collection-&gt;add("guide.child", $route);

    $route_collection-&gt;setMethods(['GET']);

    return $route_collection;
  }

}


The route that works is guide_name/foo/bar while guide_name-foo/bar doesn't work. I would like to know why. 

Reading the Symfony docs it looks like this should be a problem. But for some reason Drupal isn't liking this. Is there an undocumented (or maybe a document that I missed) that forces tokens to be delimitated with /. right now if I change the - to a / and reload the same route it works.
The dash is not the problem, you could use a dash in the fixed part, but ...


  Unlike generic Symfony routes, Drupal requires that a slug occupies a
  complete path part - the portion between two slashes (or everything
  after the last slash).


https://www.drupal.org/docs/8/api/routing-system/parameters-in-routes/using-parameters-in-routes

Alternatively you can use path processing to rewrite the path to comply with the Drupal routing system. See Do new routes in Drupal 8 *require* a static first portion?