Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java	(revision 6553)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java	(revision 6554)
@@ -22,9 +22,11 @@
     abstract public boolean applies(Environment e);
 
-    public static Condition create(String k, String v, Op op, Context context) {
+    public static Condition create(String k, String v, Op op, Context context, boolean considerValAsKey) {
         switch (context) {
         case PRIMITIVE:
-            return new KeyValueCondition(k, v, op);
+            return new KeyValueCondition(k, v, op, considerValAsKey);
         case LINK:
+            if (considerValAsKey)
+                throw new MapCSSException("''considerValAsKey'' not supported in LINK context");
             if ("role".equalsIgnoreCase(k))
                 return new RoleCondition(v, op);
@@ -144,4 +146,5 @@
         public final String v;
         public final Op op;
+        public boolean considerValAsKey;
 
         /**
@@ -151,14 +154,16 @@
          * @param v the value
          * @param op the operation
+         * @param considerValAsKey whether to consider {@code v} as another key and compare the values of key {@code k} and key {@code v}.
          */
-        public KeyValueCondition(String k, String v, Op op) {
+        public KeyValueCondition(String k, String v, Op op, boolean considerValAsKey) {
             this.k = k;
             this.v = v;
             this.op = op;
+            this.considerValAsKey = considerValAsKey;
         }
 
         @Override
         public boolean applies(Environment env) {
-            return op.eval(env.osm.get(k), v);
+            return op.eval(env.osm.get(k), considerValAsKey ? env.osm.get(v) : v);
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 6553)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj	(revision 6554)
@@ -367,13 +367,18 @@
     int i;
     Condition.Op op;
+    boolean considerValAsKey = false;
 }
 {
     key=tag_key() s()
     (
-        LOOKAHEAD(2)
-            <EQUAL> <TILDE> { op=Condition.Op.REGEX; } s() val=regex()
-        |
-        LOOKAHEAD(2)
-            <EXCLAMATION> <TILDE> { op=Condition.Op.NREGEX; } s() val=regex()
+        LOOKAHEAD(3)
+            (
+                    <EQUAL> <TILDE> { op=Condition.Op.REGEX; }
+                |
+                    <EXCLAMATION> <TILDE> { op=Condition.Op.NREGEX; }
+            )
+            s()
+            ( <STAR> { considerValAsKey=true; } )?
+            val=regex()
         |
             (
@@ -391,4 +396,5 @@
             )
             s()
+            ( <STAR> { considerValAsKey=true; } )?
             ( 
                 LOOKAHEAD(2) 
@@ -412,5 +418,5 @@
             f=float_() { val=Float.toString(f); }
     )
-    { return Condition.create(key, val, op, context); }
+    { return Condition.create(key, val, op, context, considerValAsKey); }
 }
 
