diff --git a/page_specific_class.module b/page_specific_class.module
index ca0e589e5ad0a4a9cf959639809a25683c8d1ff1..8a8dfe35b2e24ccdb845ae130f0d85f7fe9a0b9c 100755
--- a/page_specific_class.module
+++ b/page_specific_class.module
@@ -33,13 +33,10 @@ function page_specific_class_preprocess_html(&$variables) {
         $classes_array = explode(' ', $class);
         $front_page = \Drupal::service('path.matcher')->isFrontPage();
         $enteredPath = \Drupal::service('path_alias.manager')->getPathByAlias($url);
-        $alias_path = \Drupal::service('path_alias.manager')->getAliasByPath($current_path);
 
         // Check wildcard.
         if (strpos($url, '*') !== FALSE) {
-          $path = str_replace('/*', '', $url);
-          $path = str_replace('*', '', $path);
-          if (strpos($alias_path, $path) === 0) {
+          if (Drupal::service('path.matcher')->matchPath($current_path, $url)) {
             $passWildCard = TRUE;
           }
         }