Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java	(revision 5698)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java	(revision 5699)
@@ -11,4 +11,6 @@
 import java.util.Arrays;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
@@ -107,4 +109,15 @@
             }
 
+            public static Object get(List objects, float index) {
+                int idx = Math.round(index);
+                if (idx >=0 && idx < objects.size())
+                    return objects.get(idx);
+                return null;
+            }
+
+            public List split(String sep, String toSplit) {
+                return Arrays.asList(toSplit.split(Pattern.quote(sep)));
+            }
+            
             public Color rgb(float r, float g, float b) {
                 Color c = null;
@@ -229,4 +242,8 @@
             public int length(String s) {
                 return s.length();
+            }
+
+            public int length(List l) {
+                return l.size();
             }
 
@@ -263,4 +280,60 @@
                 Color res = Main.pref.getColor(s, null);
                 return res != null ? res : def;
+            }
+
+            public static boolean regexp_test(String pattern, String target) {
+                return Pattern.matches(pattern, target);
+            }
+
+            public static boolean regexp_test(String pattern, String target, String flags) {
+                int f = 0;
+                if (flags.contains("i")) {
+                    f |= Pattern.CASE_INSENSITIVE;
+                }
+                if (flags.contains("s")) {
+                    f |= Pattern.DOTALL;
+                }
+                if (flags.contains("m")) {
+                    f |= Pattern.MULTILINE;
+                }
+                return Pattern.compile(pattern, f).matcher(target).matches();
+            }
+
+            public static List regexp_match(String pattern, String target, String flags) {
+                int f = 0;
+                if (flags.contains("i")) {
+                    f |= Pattern.CASE_INSENSITIVE;
+                }
+                if (flags.contains("s")) {
+                    f |= Pattern.DOTALL;
+                }
+                if (flags.contains("m")) {
+                    f |= Pattern.MULTILINE;
+                }
+                Matcher m = Pattern.compile(pattern, f).matcher(target);
+                if (m.matches()) {
+                    List result = new ArrayList(m.groupCount());
+                    for (int i=1; i<=m.groupCount(); i++) {
+                        result.add(m.group(i));
+                    }
+                    return result;
+                } else
+                    return null;
+            }
+
+            public static List regexp_match(String pattern, String target) {
+                Matcher m = Pattern.compile(pattern).matcher(target);
+                if (m.matches()) {
+                    List result = new ArrayList(m.groupCount());
+                    for (int i=1; i<=m.groupCount(); i++) {
+                        result.add(m.group(i));
+                    }
+                    return result;
+                } else
+                    return null;
+            }
+
+            public long osm_id() {
+                return env.osm.getUniqueId();
             }
         }
