Index: trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java	(revision 11185)
+++ trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java	(revision 11192)
@@ -9,4 +9,5 @@
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
 import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
@@ -449,3 +450,16 @@
         assertTrue(SearchCompiler.compile(search2).match(tag2));
     }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13870">Bug #13870</a>.
+     * @throws ParseError always
+     */
+    @Test(expected = ParseError.class)
+    public void testPattern13870() throws ParseError {
+        // https://bugs.openjdk.java.net/browse/JI-9044959
+        SearchSetting setting = new SearchSetting();
+        setting.regexSearch = true;
+        setting.text = "[";
+        SearchCompiler.compile(setting);
+    }
 }
