Index: trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy	(revision 8873)
+++ trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy	(revision 8874)
@@ -1,6 +1,4 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.mappaint.mapcss;
-
-import static org.junit.Assert.*
 
 import org.junit.*
@@ -9,4 +7,5 @@
 import org.openstreetmap.josm.data.osm.DataSet
 import org.openstreetmap.josm.data.osm.Node
+import org.openstreetmap.josm.data.osm.OsmUtils
 import org.openstreetmap.josm.data.osm.Relation
 import org.openstreetmap.josm.data.osm.RelationMember
@@ -14,4 +13,5 @@
 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context
 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op
+import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
 
 
@@ -86,3 +86,18 @@
         assert cond.applies(e)
     }
+
+    @Test
+    public void testKeyRegexValueRegex() throws Exception {
+        def selPos = new MapCSSParser(new StringReader("*[/^source/ =~ /.*,.*/]")).selector()
+        def selNeg = new MapCSSParser(new StringReader("*[/^source/ !~ /.*,.*/]")).selector()
+        assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way foo=bar")))
+        assert selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1,2")))
+        assert selPos.matches(new Environment(OsmUtils.createPrimitive("way source_foo_bar=1,2")))
+        assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1")))
+        assert !selPos.matches(new Environment(OsmUtils.createPrimitive("way source=1")))
+        assert !selNeg.matches(new Environment(OsmUtils.createPrimitive("way source=1,2")))
+        assert !selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar source=1,2")))
+        assert selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar source=baz")))
+        assert selNeg.matches(new Environment(OsmUtils.createPrimitive("way foo=bar src=1,2")))
+    }
 }
