diff --git a/plugins/context_condition_context.inc b/plugins/context_condition_context.inc
index aca0e6a..1f1d0f2 100644
--- a/plugins/context_condition_context.inc
+++ b/plugins/context_condition_context.inc
@@ -23,6 +23,25 @@ class context_condition_context extends context_condition_path {
   }
 
   /**
+   * Get name of all contexts that match a pattern (with * wildcards).
+   *
+   * @return array machine names of all matching contexts.
+   */
+  function resolve_wildcard($pattern) {
+    if (strpos($pattern, '*') === FALSE) {
+      return array($pattern);
+    }
+    $all_contexts = array_keys(context_load());
+    $matched = array();
+    foreach ($all_contexts as $context) {
+      if (preg_match('/^' . str_replace('*', '.*', $pattern) . '$/', $context)) {
+        $matched[] = $context;
+      }
+    }
+    return $matched;
+  }
+
+  /**
    * Retrieve all context conditions.
    *
    * This method is slightly adapted to context_condition::get_contexts() in
@@ -44,11 +63,14 @@ class context_condition_context extends context_condition_path {
       if (substr($key, 0, 1) == "~") {
         $key = substr($key, 1);
       }
-      if (!isset($contexts[$key])) {
-        $context = context_load($key);
-        // Check if context exists. This will fail for wildcards.
-        if ($context) {
-          $contexts[$context->name] = $context;
+      $keys = $this->resolve_wildcard($key);
+      foreach ($keys as $key) {
+        if (!isset($contexts[$key])) {
+          $context = context_load($key);
+          // Check if context exists. This will fail for wildcards.
+          if ($context) {
+            $contexts[$context->name] = $context;
+          }
         }
       }
     }
