Index: utilsplugin2/src/utilsplugin2/selection/NodeWayUtils.java
===================================================================
--- utilsplugin2/src/utilsplugin2/selection/NodeWayUtils.java	(revision 27438)
+++ utilsplugin2/src/utilsplugin2/selection/NodeWayUtils.java	(working copy)
@@ -457,5 +457,36 @@
        // System.out.printf("Intersected intercount %d %s\n",interCount, point.toString());
         if (interCount%2 == 1) return 1; else return 0;
     }
+    
+    public static Collection<OsmPrimitive> selectAllInside(Collection<OsmPrimitive> selected, DataSet dataset) {
+        Set<Way> selectedWays = OsmPrimitive.getFilteredSet(selected, Way.class);
+        Set<Relation> selectedRels = OsmPrimitive.getFilteredSet(selected, Relation.class);
 
+        for (Relation r: selectedRels) {
+            if (!r.isMultipolygon()) selectedRels.remove(r);
+        }
+
+        Set<Way> newWays = new HashSet<Way>();
+        Set<Node> newNodes = new HashSet<Node>();
+        // select ways attached to already selected ways
+        if (!selectedWays.isEmpty()) {
+            for (Way w: selectedWays) {
+                addAllInsideWay(dataset,w,newWays,newNodes);
+            }
+        }
+        if (!selectedRels.isEmpty()) {
+            for (Relation r: selectedRels) {
+                addAllInsideMultipolygon(dataset,r,newWays,newNodes);
+            }
+        }
+        
+        Set<OsmPrimitive> insideSelection = new HashSet<OsmPrimitive>();
+        if (!newWays.isEmpty() || !newNodes.isEmpty()) {
+            insideSelection.addAll(newWays);
+            insideSelection.addAll(newNodes);
+        }
+        return insideSelection;
+    }
+
+
 }
Index: utilsplugin2/src/utilsplugin2/selection/SelectAllInsideAction.java
===================================================================
--- utilsplugin2/src/utilsplugin2/selection/SelectAllInsideAction.java	(revision 27438)
+++ utilsplugin2/src/utilsplugin2/selection/SelectAllInsideAction.java	(working copy)
@@ -14,10 +14,7 @@
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.*;
 import org.openstreetmap.josm.tools.Shortcut;
 
 /**
@@ -31,32 +28,14 @@
                 KeyEvent.VK_I, Shortcut.GROUP_EDIT ,KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK), true);
         putValue("help", ht("/Action/SelectAllInside"));
     }
-
+    
+    @Override
     public void actionPerformed(ActionEvent e) {
         long t=System.currentTimeMillis();
-        Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class);
-        Set<Relation> selectedRels = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Relation.class);
-
-        for (Relation r: selectedRels) {
-            if (!r.isMultipolygon()) selectedRels.remove(r);
-        }
-
-        Set<Way> newWays = new HashSet<Way>();
-        Set<Node> newNodes = new HashSet<Node>();
-        // select ways attached to already selected ways
-        if (!selectedWays.isEmpty()) {
-            for (Way w: selectedWays) {
-                NodeWayUtils.addAllInsideWay(getCurrentDataSet(),w,newWays,newNodes);
-            }
-        }
-        if (!selectedRels.isEmpty()) {
-            for (Relation r: selectedRels) {
-                NodeWayUtils.addAllInsideMultipolygon(getCurrentDataSet(),r,newWays,newNodes);
-            }
-        }
-        if (!newWays.isEmpty() || !newNodes.isEmpty()) {
-            getCurrentDataSet().addSelected(newWays);
-            getCurrentDataSet().addSelected(newNodes);
+        Collection<OsmPrimitive> insideSelected = NodeWayUtils.selectAllInside(getCurrentDataSet().getSelected(), getCurrentDataSet());
+        
+        if (!insideSelected.isEmpty()) {
+            getCurrentDataSet().addSelected(insideSelected);
         } else{
         JOptionPane.showMessageDialog(Main.parent,
                tr("Nothing found. Please select some closed ways or multipolygons to find all primitives inside them!"),
Index: utilsplugin2/src/utilsplugin2/UtilsPlugin2.java
===================================================================
--- utilsplugin2/src/utilsplugin2/UtilsPlugin2.java	(revision 27438)
+++ utilsplugin2/src/utilsplugin2/UtilsPlugin2.java	(working copy)
@@ -1,18 +1,29 @@
 // License: GPL v2 or later. See LICENSE file for details.
 package utilsplugin2;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import utilsplugin2.customurl.ChooseURLAction;
 import utilsplugin2.customurl.OpenPageAction;
 import utilsplugin2.customurl.UtilsPluginPreferences;
 
 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
 import java.awt.event.KeyEvent;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import utilsplugin2.selection.*;
 import utilsplugin2.dumbutils.*;
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.search.PushbackTokenizer;
+import org.openstreetmap.josm.actions.search.SearchCompiler;
+import org.openstreetmap.josm.actions.search.SearchCompiler.*;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.Plugin;
@@ -87,7 +98,8 @@
         
         selectURL = MainMenu.add(toolsMenu, new ChooseURLAction());
         
-
+        // register search operators
+        SearchCompiler.addMatchFactory(new UtilsMatchFactory());
     }
 
     @Override
@@ -124,5 +136,83 @@
     public PreferenceSetting getPreferenceSetting() {
         return new UtilsPluginPreferences();
     }
+    
+    public class UtilsMatchFactory implements MatchFactory {
 
+        @Override
+        public Match getSimpleMatch(String keyword, PushbackTokenizer tokenizer) throws ParseError {
+            return null;
+        }
+
+        @Override
+        public UnaryMatch getUnaryMatch(String keyword, Match matchOperand, PushbackTokenizer tokenizer) throws ParseError {
+            if ("inside".equals(keyword))
+                return new InsideMatch(matchOperand);
+            return null;
+        }
+
+        @Override
+        public BinaryMatch getBinaryMatch(String keyword, Match lhs, Match rhs, PushbackTokenizer tokenizer) throws ParseError {
+            return null;
+        }
+
+        @Override
+        public Collection<String> getKeywords() {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+        @Override
+        public boolean isUnaryMatch(String keyword) {
+            if ("inside".equals(keyword))
+                return true;
+            return false;
+        }
+
+        @Override
+        public boolean isBinaryMatch(String keyword) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+        
+    }
+
+    /**
+     * Matches all objects contained within the match expression.
+     */
+    public static class InsideMatch extends UnaryMatch {
+        private Collection<OsmPrimitive> inside = null;
+        
+        public InsideMatch(Match match) {
+            super(match);
+            init();
+            
+        }
+        
+        /**
+         * Find all objects inside areas which match the expression
+         */
+        private void init() {
+            Collection<OsmPrimitive> matchedAreas = new HashSet<OsmPrimitive>();
+
+            // find all ways that match the expression
+            Collection<Way> ways = Main.main.getCurrentDataSet().getWays();
+            for (Way way : ways) {
+                if (match.match(way))
+                    matchedAreas.add(way);
+            }
+            
+            // find all relations that match the expression
+            Collection<Relation> rels = Main.main.getCurrentDataSet().getRelations();
+            for (Relation rel : rels) {
+                if (match.match(rel))
+                    matchedAreas.add(rel);
+            }
+            
+            inside = NodeWayUtils.selectAllInside(matchedAreas, Main.main.getCurrentDataSet());
+        }
+
+        @Override
+        public boolean match(OsmPrimitive osm) {
+            return inside.contains(osm);
+        }
+    }
 }
