Get route name from path with wildcard we've wanted to implement a policy to consider some URLs as whitelist, I've provided a config form to admin to enter whitelist Urls, separated by newline, it must support * ( wildcard).

sample urls are 

/user/*/edit
/coming-soon


and my implementation 

$config = $config_factory-&gt;get('mint_coming_soon.softlaunchconfigadmin');

$white_route_list = $config-&gt;get('white_path_list');
$white_route_list = $white_route_list ? preg_split("/\\r\\n|\\r|\\n/", $white_route_list) : NULL;
$is_white_route = FALSE;
foreach ($white_route_list as $route) {
  $route_name = $this-&gt;pathValidator-&gt;getUrlIfValid($route);
  $route_name = $route_name ? $route_name-&gt;getRouteName() : NULL;
  drupal_set_message($route_name);
  $current_route_name = \Drupal::routeMatch()-&gt;getRouteName();
  if ($current_route_name == $route_name) {
    $is_white_route = TRUE;
    break;
  }
}


$this-&gt;pathValidator-&gt;getUrlIfValid doesn't work on URLs with the wildcard, my question is how can I get the route name of Url which contains a wildcard?

Notice: wildcard in this question is particularly *.
$pattern = '/user/*/edit';
$route_provider = \Drupal::service('router.route_provider');
$found_routes = $route_provider-&gt;getRoutesByPattern($pattern);
$route_names = [];
foreach ($found_routes as $route_name =&gt; $route_object) {
  $route_names[] = $route_name;
}