Index: src/org/openstreetmap/josm/actions/PasteTagsAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/PasteTagsAction.java	(revision 6099)
+++ src/org/openstreetmap/josm/actions/PasteTagsAction.java	(working copy)
@@ -12,6 +12,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.ChangePropertyCommand;
@@ -60,7 +61,7 @@
 
         /**
          * Replies true if the source for tag pasting is heterogeneous, i.e. if it doesn't consist of
-         * {@link OsmPrimitive}s of exactly one type
+         * {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s of exactly one type
          */
         protected boolean isHeteogeneousSource() {
             int count = 0;
@@ -135,8 +136,8 @@
         }
 
         /**
-         * Pastes the tags from a homogeneous source (the {@link Main#pasteBuffer}s selection consisting
-         * of one type of {@link OsmPrimitive}s only).
+         * Pastes the tags from a homogeneous source (the {@link org.openstreetmap.josm.Main#pasteBuffer}s selection consisting
+         * of one type of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s only).
          *
          * Tags from a homogeneous source can be pasted to a heterogeneous target. All target primitives,
          * regardless of their type, receive the same tags.
@@ -241,6 +242,8 @@
 
     }
 
+    private static final Pattern ACTION_PERFORMED_PATTERN = Pattern.compile("(\\d+,)*\\d+");
+
     @Override
     public void actionPerformed(ActionEvent e) {
         Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
@@ -249,7 +252,7 @@
             return;
 
         String buf = Utils.getClipboardContent();
-        if (buf == null || buf.isEmpty() || buf.matches("(\\d+,)*\\d+")) {
+        if (buf == null || buf.isEmpty() || ACTION_PERFORMED_PATTERN.matcher(buf).matches()) {
             pasteTagsFromJOSMBuffer(selection);
         } else {
             // Paste tags from arbitrary text
@@ -285,7 +288,7 @@
         List<PrimitiveData> directlyAdded = Main.pasteBuffer.getDirectlyAdded();
         if (directlyAdded==null || directlyAdded.isEmpty()) return false;
 
-        PasteTagsAction.TagPaster tagPaster = new PasteTagsAction.TagPaster(directlyAdded, selection);
+        TagPaster tagPaster = new TagPaster(directlyAdded, selection);
         List<Command> commands = new ArrayList<Command>();
         for (Tag tag : tagPaster.execute()) {
             commands.add(new ChangePropertyCommand(selection, tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue()));
Index: src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeCompressedTask.java
===================================================================
--- src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeCompressedTask.java	(revision 6099)
+++ src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeCompressedTask.java	(working copy)
@@ -2,6 +2,7 @@
 package org.openstreetmap.josm.actions.downloadtasks;
 
 import java.util.concurrent.Future;
+import java.util.regex.Pattern;
 
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -17,6 +18,7 @@
  */
 public class DownloadOsmChangeCompressedTask extends DownloadOsmChangeTask {
 
+
     @Override
     public String[] getPatterns() {
         return new String[]{"https?://.*/.*\\.osc.(gz|bz2?)"};
@@ -26,7 +28,9 @@
     public String getTitle() {
         return tr("Download Compressed OSM Change");
     }
-    
+
+    private static final Pattern LOAD_URL_PATTERN = Pattern.compile("https?://.*/.*\\.osc.bz2?");
+
     /**
      * Loads a given URL
      * @param new_layer {@code true} if the data should be saved to a new layer
@@ -39,7 +43,7 @@
             @Override
             protected DataSet parseDataSet() throws OsmTransferException {
                 ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
-                if (url.matches("https?://.*/.*\\.osc.bz2?")) {
+                if (LOAD_URL_PATTERN.matcher(url).matches()) {
                     return reader.parseOsmChangeBzip2(subTaskMonitor);
                 } else {
                     return reader.parseOsmChangeGzip(subTaskMonitor);
Index: src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java
===================================================================
--- src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java	(revision 6099)
+++ src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java	(working copy)
@@ -2,6 +2,7 @@
 package org.openstreetmap.josm.actions.downloadtasks;
 
 import java.util.concurrent.Future;
+import java.util.regex.Pattern;
 
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -38,7 +39,9 @@
             ProgressMonitor progressMonitor) {
         return null;
     }
-    
+
+    private static final Pattern LOAD_URL_PATTERN = Pattern.compile("https?://.*/.*\\.osm.bz2?");
+
     /**
      * Loads a given URL
      * @param new_layer {@code true} if the data should be saved to a new layer
@@ -51,7 +54,7 @@
             @Override
             protected DataSet parseDataSet() throws OsmTransferException {
                 ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
-                if (url.matches("https?://.*/.*\\.osm.bz2?")) {
+                if (LOAD_URL_PATTERN.matcher(url).matches()) {
                     return reader.parseOsmBzip2(subTaskMonitor);
                 } else {
                     return reader.parseOsmGzip(subTaskMonitor);
Index: src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 6099)
+++ src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(working copy)
@@ -21,7 +21,6 @@
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.BoundingBoxDownloader;
 import org.openstreetmap.josm.io.OsmServerLocationReader;
@@ -41,6 +40,10 @@
     private static final String PATTERN_OVERPASS_API_XAPI_URL = "http://.*/xapi\\?.*\\[@meta\\].*";
     private static final String PATTERN_EXTERNAL_OSM_FILE     = "https?://.*/.*\\.osm";
 
+    private static final Pattern PATTERN_OVERPASS_API_URL_COMPILED = Pattern.compile(PATTERN_OVERPASS_API_URL);
+    private static final Pattern PATTERN_OVERPASS_API_XAPI_URL_COMPILED = Pattern.compile(PATTERN_OVERPASS_API_XAPI_URL);
+    private static final Pattern PATTERN_OSM_API_URL_COMPILED = Pattern.compile(PATTERN_OSM_API_URL);
+
     protected Bounds currentBounds;
     protected DataSet downloadedData;
     protected DownloadTask downloadTask;
@@ -73,8 +76,8 @@
     }
 
     /**
-     * Replies the {@link DataSet} containing the downloaded OSM data.
-     * @return The {@link DataSet} containing the downloaded OSM data.
+     * Replies the {@link org.openstreetmap.josm.data.osm.DataSet} containing the downloaded OSM data.
+     * @return The {@link org.openstreetmap.josm.data.osm.DataSet} containing the downloaded OSM data.
      */
     public DataSet getDownloadedData() {
         return downloadedData;
@@ -89,11 +92,11 @@
      * Asynchronously launches the download task for a given bounding box.
      *
      * Set <code>progressMonitor</code> to null, if the task should create, open, and close a progress monitor.
-     * Set progressMonitor to {@link NullProgressMonitor#INSTANCE} if progress information is to
+     * Set progressMonitor to {@link org.openstreetmap.josm.gui.progress.NullProgressMonitor#INSTANCE} if progress information is to
      * be discarded.
      *
      * You can wait for the asynchronous download task to finish by synchronizing on the returned
-     * {@link Future}, but make sure not to freeze up JOSM. Example:
+     * {@link java.util.concurrent.Future}, but make sure not to freeze up JOSM. Example:
      * <pre>
      *    Future<?> future = task.download(...);
      *    // DON'T run this on the Swing EDT or JOSM will freeze
@@ -115,7 +118,7 @@
      *    }
      *    Main.worker.submit(runAfterTask);
      * </pre>
-     * @param reader the reader used to parse OSM data (see {@link OsmServerReader#parseOsm})
+     * @param reader the reader used to parse OSM data (see {@link org.openstreetmap.josm.io.OsmServerReader#parseOsm})
      * @param newLayer true, if the data is to be downloaded into a new layer. If false, the task
      *                 selects one of the existing layers as download layer, preferably the active layer.
      * @param downloadArea the area to download
@@ -156,10 +159,10 @@
      */
     @Override
     public Future<?> loadUrl(boolean new_layer, String url, ProgressMonitor progressMonitor) {
-        if (url.matches(PATTERN_OVERPASS_API_URL)) {
+        if (PATTERN_OVERPASS_API_URL_COMPILED.matcher(url).matches()) {
             url = encodePartialUrl(url, "/interpreter?data="); // encode only the part after the = sign
 
-        } else if (url.matches(PATTERN_OVERPASS_API_XAPI_URL)) {
+        } else if (PATTERN_OVERPASS_API_XAPI_URL_COMPILED.matcher(url).matches()) {
             url = encodePartialUrl(url, "/xapi?"); // encode only the part after the ? sign
         }
         downloadTask = new DownloadTask(new_layer,
@@ -315,16 +318,18 @@
         }
     }
 
+    private static final Pattern CLEAR_URL_PATTERN = Pattern.compile(",\\s*");
+
     @Override
     public String getConfirmationMessage(URL url) {
         if (url != null) {
             String urlString = url.toExternalForm();
-            if (urlString.matches(PATTERN_OSM_API_URL)) {
+            if (PATTERN_OSM_API_URL_COMPILED.matcher(urlString).matches()) {
                 // TODO: proper i18n after stabilization
                 String message = "<ul><li>"+tr("OSM Server URL:") + " " + url.getHost() + "</li><li>" +
                         tr("Command")+": "+url.getPath()+"</li>";
                 if (url.getQuery() != null) {
-                    message += "<li>" + tr("Request details: {0}", url.getQuery().replaceAll(",\\s*", ", ")) + "</li>";
+                    message += "<li>" + tr("Request details: {0}", CLEAR_URL_PATTERN.matcher(url.getQuery()).replaceAll(", ")) + "</li>";
                 }
                 message += "</ul>";
                 return message;
Index: src/org/openstreetmap/josm/data/AutosaveTask.java
===================================================================
--- src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/AutosaveTask.java	(working copy)
@@ -271,8 +271,10 @@
         changedDatasets.add(event.getDataset());
     }
 
+    private static final Pattern REPLACE_FIRST_PATTERN = Pattern.compile("[.][^.]+$");
+
     private final File getPidFile(File osmFile) {
-        return new File(autosaveDir, osmFile.getName().replaceFirst("[.][^.]+$", ".pid"));
+        return new File(autosaveDir, REPLACE_FIRST_PATTERN.matcher(osmFile.getName()).replaceFirst(".pid"));
     }
 
     /**
Index: src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(working copy)
@@ -402,6 +402,8 @@
         termsOfUseURL = text;
     }
 
+    private static final Pattern EXTENDED_URL_PATTERN = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*");
+
     public void setExtendedUrl(String url) {
         CheckParameterUtil.ensureParameterNotNull(url);
 
@@ -429,7 +431,7 @@
         if(serverProjections == null || serverProjections.isEmpty()) {
             try {
                 serverProjections = new ArrayList<String>();
-                Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase());
+                Matcher m = EXTENDED_URL_PATTERN.matcher(url.toUpperCase());
                 if(m.matches()) {
                     for(String p : m.group(1).split(","))
                         serverProjections.add(p);
Index: src/org/openstreetmap/josm/data/osm/TagCollection.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/TagCollection.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/osm/TagCollection.java	(working copy)
@@ -15,25 +15,27 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.regex.Pattern;
+
 import org.openstreetmap.josm.tools.Utils;
 
 /**
  * TagCollection is a collection of tags which can be used to manipulate
- * tags managed by {@link OsmPrimitive}s.
+ * tags managed by {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s.
  *
  * A TagCollection can be created:
  * <ul>
- *  <li>from the tags managed by a specific {@link OsmPrimitive} with {@link #from(Tagged)}</li>
- *  <li>from the union of all tags managed by a collection of {@link OsmPrimitive}s with {@link #unionOfAllPrimitives(Collection)}</li>
- *  <li>from the union of all tags managed by a {@link DataSet} with {@link #unionOfAllPrimitives(DataSet)}</li>
- *  <li>from the intersection of all tags managed by a collection of primitives with {@link #commonToAllPrimitives(Collection)}</li>
+ *  <li>from the tags managed by a specific {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with {@link #from(org.openstreetmap.josm.data.osm.Tagged)}</li>
+ *  <li>from the union of all tags managed by a collection of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s with {@link #unionOfAllPrimitives(java.util.Collection)}</li>
+ *  <li>from the union of all tags managed by a {@link org.openstreetmap.josm.data.osm.DataSet} with {@link #unionOfAllPrimitives(org.openstreetmap.josm.data.osm.DataSet)}</li>
+ *  <li>from the intersection of all tags managed by a collection of primitives with {@link #commonToAllPrimitives(java.util.Collection)}</li>
  * </ul>
  *
  * It  provides methods to query the collection, like {@link #size()}, {@link #hasTagsFor(String)}, etc.
  *
  * Basic set operations allow to create the union, the intersection and  the difference
- * of tag collections, see {@link #union(TagCollection)}, {@link #intersect(TagCollection)},
- * and {@link #minus(TagCollection)}.
+ * of tag collections, see {@link #union(org.openstreetmap.josm.data.osm.TagCollection)}, {@link #intersect(org.openstreetmap.josm.data.osm.TagCollection)},
+ * and {@link #minus(org.openstreetmap.josm.data.osm.TagCollection)}.
  *
  *
  */
@@ -41,12 +43,12 @@
 
     /**
      * Creates a tag collection from the tags managed by a specific
-     * {@link OsmPrimitive}. If <code>primitive</code> is null, replies
+     * {@link org.openstreetmap.josm.data.osm.OsmPrimitive}. If <code>primitive</code> is null, replies
      * an empty tag collection.
      *
      * @param primitive  the primitive
      * @return a tag collection with the tags managed by a specific
-     * {@link OsmPrimitive}
+     * {@link org.openstreetmap.josm.data.osm.OsmPrimitive}
      */
     public static TagCollection from(Tagged primitive) {
         TagCollection tags = new TagCollection();
@@ -589,7 +591,7 @@
     }
 
     /**
-     * Applies this tag collection to an {@link OsmPrimitive}. Does nothing if
+     * Applies this tag collection to an {@link org.openstreetmap.josm.data.osm.OsmPrimitive}. Does nothing if
      * primitive is null
      *
      * @param primitive  the primitive
@@ -610,7 +612,7 @@
     }
 
     /**
-     * Applies this tag collection to a collection of {@link OsmPrimitive}s. Does nothing if
+     * Applies this tag collection to a collection of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s. Does nothing if
      * primitives is null
      *
      * @param primitives  the collection of primitives
@@ -627,7 +629,7 @@
     }
 
     /**
-     * Replaces the tags of an {@link OsmPrimitive} by the tags in this collection . Does nothing if
+     * Replaces the tags of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} by the tags in this collection . Does nothing if
      * primitive is null
      *
      * @param primitive  the primitive
@@ -645,7 +647,7 @@
     }
 
     /**
-     * Replaces the tags of a collection of{@link OsmPrimitive}s by the tags in this collection.
+     * Replaces the tags of a collection of{@link org.openstreetmap.josm.data.osm.OsmPrimitive}s by the tags in this collection.
      * Does nothing if primitives is null
      *
      * @param primitives the collection of primitives
@@ -715,6 +717,8 @@
         return ret;
     }
 
+    private static final Pattern SPLIT_VALUES_PATTERN = Pattern.compile(";\\s*");
+
     /**
      * Replies the concatenation of all tag values (concatenated by a semicolon)
      *
@@ -731,7 +735,7 @@
         Set<String> values = new LinkedHashSet<String>();
         Map<String, Collection<String>> originalSplitValues = new LinkedHashMap<String, Collection<String>>();
         for (String v : originalValues) {
-            List<String> vs = Arrays.asList(v.split(";\\s*"));
+            List<String> vs = Arrays.asList(SPLIT_VALUES_PATTERN.split(v));
             originalSplitValues.put(v, vs);
             values.addAll(vs);
         }
Index: src/org/openstreetmap/josm/data/preferences/ColorProperty.java
===================================================================
--- src/org/openstreetmap/josm/data/preferences/ColorProperty.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/preferences/ColorProperty.java	(working copy)
@@ -2,12 +2,13 @@
 package org.openstreetmap.josm.data.preferences;
 
 import java.awt.Color;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Preferences.ColorKey;
 
 /**
- * A property containing a {@link Color} value.
+ * A property containing a {@link java.awt.Color} value.
  * @since 5464
  */
 public class ColorProperty extends AbstractProperty<Color> implements ColorKey {
@@ -33,14 +34,16 @@
     public boolean put(Color value) {
         return Main.pref.putColor(getColorKey(name), value);
     }
-    
+
+    private static final Pattern COLOR_KEY_PATTERN = Pattern.compile("[^a-z0-9]+");
+
     /**
      * Replies the color key used in JOSM preferences for this property.
      * @param colName The color name
      * @return The color key for this property
      */
     public static String getColorKey(String colName) {
-        return colName == null ? null : colName.toLowerCase().replaceAll("[^a-z0-9]+",".");
+        return colName == null ? null : COLOR_KEY_PATTERN.matcher(colName.toLowerCase()).replaceAll(".");
     }
 
     @Override
Index: src/org/openstreetmap/josm/data/projection/CustomProjection.java
===================================================================
--- src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/projection/CustomProjection.java	(working copy)
@@ -155,7 +155,7 @@
 
     private Map<String, String> parseParameterList(String pref) throws ProjectionConfigurationException {
         Map<String, String> parameters = new HashMap<String, String>();
-        String[] parts = pref.trim().split("\\s+");
+        String[] parts = Utils.WHITE_SPACES_PATTERN.split(pref.trim());
         if (pref.trim().isEmpty()) {
             parts = new String[0];
         }
Index: src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java	(working copy)
@@ -6,6 +6,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map.Entry;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.validation.Severity;
@@ -31,6 +32,7 @@
 public class NameMismatch extends Test {
     protected static final int NAME_MISSING = 1501;
     protected static final int NAME_TRANSLATION_MISSING = 1502;
+    private static final Pattern NAME_SPLIT_PATTERN = Pattern.compile(" - ");
 
     public NameMismatch() {
         super(tr("Missing name:* translation"),
@@ -81,7 +83,7 @@
         composition of some (not necessarily all) name:* labels.
         Check if this is the case. */
 
-        String[] split_names = name.split(" - ");
+        String[] split_names = NAME_SPLIT_PATTERN.split(name);
         if (split_names.length == 1) {
             /* The name is not composed of multiple parts. Complain. */
             missingTranslation(p);
Index: src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
===================================================================
--- src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 6099)
+++ src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(working copy)
@@ -823,9 +823,13 @@
             }
         };
 
-        public String getData(String str) {
-            Matcher m = Pattern.compile(" *# *([^#]+) *$").matcher(str);
-            str = m.replaceFirst("").trim();
+        private static final Pattern CLEAN_STR_PATTERN = Pattern.compile(" *# *([^#]+) *$");
+        private static final Pattern SPLIT_TRIMMED_PATTERN = Pattern.compile(" *: *");
+        private static final Pattern SPLIT_ELEMENTS_PATTERN = Pattern.compile(" *&& *");
+
+        public String getData(final String str) {
+            Matcher m = CLEAN_STR_PATTERN.matcher(str);
+            String trimmed = m.replaceFirst("").trim();
             try {
                 description = m.group(1);
                 if (description != null && description.length() == 0) {
@@ -834,7 +838,7 @@
             } catch (IllegalStateException e) {
                 description = null;
             }
-            String[] n = str.split(" *: *", 3);
+            String[] n = SPLIT_TRIMMED_PATTERN.split(trimmed, 3);
             if (n[0].equals("way")) {
                 type = OsmPrimitiveType.WAY;
             } else if (n[0].equals("node")) {
@@ -859,7 +863,7 @@
                 code = TAG_CHECK_INFO;
             } else
                 return tr("Could not find warning level");
-            for (String exp: n[2].split(" *&& *")) {
+            for (String exp: SPLIT_ELEMENTS_PATTERN.split(n[2])) {
                 try {
                     data.add(new CheckerElement(exp));
                 } catch (IllegalStateException e) {
Index: src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java	(working copy)
@@ -55,7 +55,7 @@
     private static final char E_TR = LatLon.EAST.charAt(0);
     private static final char W_TR = LatLon.WEST.charAt(0);
 
-    private static final Pattern p = Pattern.compile(
+    private static final Pattern LAT_LNG_PATTERN = Pattern.compile(
             "([+|-]?\\d+[.,]\\d+)|"             // (1)
             + "([+|-]?\\d+)|"                   // (2)
             + "("+DEG+"|o|deg)|"                // (3)
@@ -66,6 +66,16 @@
             + "\\s+|"
             + "(.+)");
 
+    private static final Pattern TYPE1_PATTERN = Pattern.compile("Ro?,?Ro?");
+    private static final Pattern TYPE2_PATTERN = Pattern.compile("xRo?,?xRo?");
+    private static final Pattern TYPE3_PATTERN = Pattern.compile("Ro?x,?Ro?x");
+    private static final Pattern TYPE4_PATTERN = Pattern.compile("Zo[RZ]'?,?Zo[RZ]'?|Z[RZ],?Z[RZ]");
+    private static final Pattern TYPE5_PATTERN = Pattern.compile("xZo[RZ]'?,?xZo[RZ]'?|xZo?[RZ],?xZo?[RZ]");
+    private static final Pattern TYPE6_PATTERN = Pattern.compile("Zo[RZ]'?x,?Zo[RZ]'?x|Zo?[RZ]x,?Zo?[RZ]x");
+    private static final Pattern TYPE7_PATTERN = Pattern.compile("ZoZ'[RZ]\"?x,?ZoZ'[RZ]\"?x|ZZ[RZ]x,?ZZ[RZ]x");
+    private static final Pattern TYPE8_PATTERN = Pattern.compile("xZoZ'[RZ]\"?,?xZoZ'[RZ]\"?|xZZ[RZ],?xZZ[RZ]");
+    private static final Pattern TYPE9_PATTERN = Pattern.compile("ZZ[RZ],?ZZ[RZ]");
+
     protected JPanel buildLatLon() {
         JPanel pnl = new JPanel(new GridBagLayout());
         pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
@@ -341,7 +351,7 @@
     }
 
     private static LatLon parseLatLon(final String coord) {
-        final Matcher m = p.matcher(coord);
+        final Matcher m = LAT_LNG_PATTERN.matcher(coord);
 
         final StringBuilder sb = new StringBuilder();
         final List<Object> list = new ArrayList<Object>();
@@ -380,39 +390,39 @@
         final Object[] params = list.toArray();
         final LatLonHolder latLon = new LatLonHolder();
 
-        if (pattern.matches("Ro?,?Ro?")) {
+        if (TYPE1_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], ZERO, ZERO, "N",
                     params[1], ZERO, ZERO, "E");
-        } else if (pattern.matches("xRo?,?xRo?")) {
+        } else if (TYPE2_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[1], ZERO, ZERO, params[0],
                     params[3], ZERO, ZERO, params[2]);
-        } else if (pattern.matches("Ro?x,?Ro?x")) {
+        } else if (TYPE3_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], ZERO, ZERO, params[1],
                     params[2], ZERO, ZERO, params[3]);
-        } else if (pattern.matches("Zo[RZ]'?,?Zo[RZ]'?|Z[RZ],?Z[RZ]")) {
+        } else if (TYPE4_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], params[1], ZERO, "N",
                     params[2], params[3], ZERO, "E");
-        } else if (pattern.matches("xZo[RZ]'?,?xZo[RZ]'?|xZo?[RZ],?xZo?[RZ]")) {
+        } else if (TYPE5_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[1], params[2], ZERO, params[0],
                     params[4], params[5], ZERO, params[3]);
-        } else if (pattern.matches("Zo[RZ]'?x,?Zo[RZ]'?x|Zo?[RZ]x,?Zo?[RZ]x")) {
+        } else if (TYPE6_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], params[1], ZERO, params[2],
                     params[3], params[4], ZERO, params[5]);
-        } else if (pattern.matches("ZoZ'[RZ]\"?x,?ZoZ'[RZ]\"?x|ZZ[RZ]x,?ZZ[RZ]x")) {
+        } else if (TYPE7_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], params[1], params[2], params[3],
                     params[4], params[5], params[6], params[7]);
-        } else if (pattern.matches("xZoZ'[RZ]\"?,?xZoZ'[RZ]\"?|xZZ[RZ],?xZZ[RZ]")) {
+        } else if (TYPE8_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[1], params[2], params[3], params[0],
                     params[5], params[6], params[7], params[4]);
-        } else if (pattern.matches("ZZ[RZ],?ZZ[RZ]")) {
+        } else if (TYPE9_PATTERN.matcher(pattern).matches()) {
             setLatLonObj(latLon,
                     params[0], params[1], params[2], "N",
                     params[3], params[4], params[5], "E");
@@ -423,8 +433,10 @@
         return new LatLon(latLon.lat, latLon.lon);
     }
 
+    private static final Pattern SPLIT_EN_PATTERN = Pattern.compile("[;, ]+");
+
     private static EastNorth parseEastNorth(String s) {
-        String[] en = s.split("[;, ]+");
+        String[] en = SPLIT_EN_PATTERN.split(s);
         if (en.length != 2) return null;
         try {
             double east = Double.parseDouble(en[0]);
Index: src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java	(working copy)
@@ -9,8 +9,10 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.tools.Utils;
 
 public class RelationSorter {
 
@@ -47,8 +49,9 @@
                     String addrB = b.getMember().get("addr:housenumber").trim();
                     if (addrA.equals(addrB)) return 0;
                     // Strip non-digits (from "1B" addresses for example)
-                    String addrAnum = addrA.replaceAll("\\D+", "");
-                    String addrBnum = addrB.replaceAll("\\D+", "");
+                    String addrAnum = Utils.DIGITS_PATTERN.matcher(addrA).replaceAll("");
+                    String addrBnum = Utils.DIGITS_PATTERN.matcher(addrB).replaceAll("");
+
                     // Compare only numbers
                     try {
                         Integer res = Integer.parseInt(addrAnum) - Integer.parseInt(addrBnum);
Index: src/org/openstreetmap/josm/gui/help/HelpBrowser.java
===================================================================
--- src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(working copy)
@@ -18,6 +18,7 @@
 import java.util.Locale;
 import java.util.Observable;
 import java.util.Observer;
+import java.util.regex.Pattern;
 
 import javax.swing.AbstractAction;
 import javax.swing.JButton;
@@ -38,6 +39,7 @@
 import javax.swing.text.Document;
 import javax.swing.text.Element;
 import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.html.HTML;
 import javax.swing.text.html.HTML.Tag;
 import javax.swing.text.html.HTMLDocument;
 import javax.swing.text.html.StyleSheet;
@@ -55,6 +57,7 @@
 import org.openstreetmap.josm.tools.WindowGeometry;
 
 public class HelpBrowser extends JDialog {
+
     /** the unique instance */
     private static HelpBrowser instance;
 
@@ -435,7 +438,10 @@
         }
     }
 
+    private static final Pattern CLEAN_URL_PATTERN = Pattern.compile("#[^#]*$");
+
     class EditAction extends AbstractAction {
+
         public EditAction() {
             // putValue(NAME, tr("Edit"));
             putValue(SHORT_DESCRIPTION, tr("Edit the current help page"));
@@ -463,7 +469,7 @@
                 );
                 return;
             }
-            url = url.replaceAll("#[^#]*$", "");
+            url = CLEAN_URL_PATTERN.matcher(url).replaceAll("");
             OpenBrowser.displayUrl(url+"?action=edit");
         }
     }
@@ -537,6 +543,8 @@
         }
     }
 
+    private static final Pattern HYPERLINK_URL_PATTERN = Pattern.compile("#.*");
+
     class HyperlinkHandler implements HyperlinkListener {
 
         /**
@@ -582,10 +590,10 @@
             Object value = set.getAttribute(Tag.A);
             if (value == null || ! (value instanceof SimpleAttributeSet)) return null;
             SimpleAttributeSet atts = (SimpleAttributeSet)value;
-            value = atts.getAttribute(javax.swing.text.html.HTML.Attribute.HREF);
+            value = atts.getAttribute(HTML.Attribute.HREF);
             if (value == null) return null;
             String s = (String)value;
-            if (s.matches("#.*"))
+            if (HYPERLINK_URL_PATTERN.matcher(s).matches())
                 return s.substring(1);
             return null;
         }
Index: src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java	(working copy)
@@ -5,6 +5,7 @@
 import java.awt.LayoutManager;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.regex.Pattern;
 
 import javax.swing.AbstractButton;
 import javax.swing.JPanel;
@@ -20,8 +21,8 @@
 
 /**
  * An abstract imagery panel used to add WMS/TMS imagery sources. See implementations.
- * @see AddTMSLayerPanel
- * @see AddWMSLayerPanel
+ * @see org.openstreetmap.josm.gui.preferences.imagery.AddTMSLayerPanel
+ * @see org.openstreetmap.josm.gui.preferences.imagery.AddWMSLayerPanel
  * @since 5617
  */
 public abstract class AddImageryPanel extends JPanel {
@@ -67,8 +68,10 @@
 
     protected abstract ImageryInfo getImageryInfo();
 
+    private static final Pattern SANITIZE_PATTERN = Pattern.compile("[\r\n]+");
+
     protected static String sanitize(String s) {
-        return s.replaceAll("[\r\n]+", "").trim();
+        return SANITIZE_PATTERN.matcher(s).replaceAll("").trim();
     }
 
     protected final String getImageryName() {
Index: src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java	(working copy)
@@ -1,23 +1,19 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.preferences.shortcut;
 
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Toolkit;
+import java.awt.*;
 
 import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
@@ -47,6 +43,7 @@
 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
 import org.openstreetmap.josm.tools.Shortcut;
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
  * This is the keyboard preferences content.
@@ -194,7 +191,7 @@
         CbAction action = new CbAction(this);
         setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
         add(buildFilterPanel());
-        listPane.setLayout(new java.awt.GridLayout());
+        listPane.setLayout(new GridLayout());
 
         // This is the list of shortcuts:
         shortcutTable.setModel(model);
@@ -212,7 +209,7 @@
         add(listPane);
 
         // and here follows the edit area. I won't object to someone re-designing it, it looks, um, "minimalistic" ;)
-        shortcutEditPane.setLayout(new java.awt.GridLayout(5, 2));
+        shortcutEditPane.setLayout(new GridLayout(5, 2));
 
         cbDefault.setAction(action);
         cbDefault.setText(tr("Use default"));
@@ -321,7 +318,7 @@
             }
         }
         @Override
-        public void actionPerformed(java.awt.event.ActionEvent e) {
+        public void actionPerformed(ActionEvent e) {
             ListSelectionModel lsm = panel.shortcutTable.getSelectionModel();
             if (lsm != null && !lsm.isSelectionEmpty()) {
                 if (e != null) { // only if we've been called by a user action
@@ -375,7 +372,7 @@
                     expr = expr.replace("+", "\\+");
                     // split search string on whitespace, do case-insensitive AND search
                     ArrayList<RowFilter<Object, Object>> andFilters = new ArrayList<RowFilter<Object, Object>>();
-                    for (String word : expr.split("\\s+")) {
+                    for (String word : Utils.WHITE_SPACES_PATTERN.split(expr)) {
                         andFilters.add(RowFilter.regexFilter("(?i)" + word));
                     }
                     sorter.setRowFilter(RowFilter.andFilter(andFilters));
Index: src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
===================================================================
--- src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(working copy)
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
+import java.util.regex.Pattern;
 import javax.swing.ButtonGroup;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
@@ -145,12 +146,13 @@
                             : short_description;
         }
 
+        private static final Pattern REMOVE_MARKUP_PATTERN = Pattern.compile("<.*>");
         // toString is mainly used to initialize the Editor
         @Override
         public String toString() {
             if (value.equals(DIFFERENT))
                 return DIFFERENT;
-            return getDisplayValue(true).replaceAll("<.*>", ""); // remove additional markup, e.g. <br>
+            return REMOVE_MARKUP_PATTERN.matcher(getDisplayValue(true)).replaceAll(""); // remove additional markup, e.g. <br>
         }
     }
 
Index: src/org/openstreetmap/josm/gui/util/GuiHelper.java
===================================================================
--- src/org/openstreetmap/josm/gui/util/GuiHelper.java	(revision 6099)
+++ src/org/openstreetmap/josm/gui/util/GuiHelper.java	(working copy)
@@ -21,6 +21,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import java.util.List;
+import java.util.regex.Pattern;
 
 import javax.swing.GrayFilter;
 import javax.swing.Icon;
@@ -37,6 +38,7 @@
  * basic gui utils
  */
 public class GuiHelper {
+
     /**
      * disable / enable a component and all its child components
      */
@@ -171,13 +173,15 @@
         return timer;
     }
 
+    private static final Pattern CUSTOMIZED_STROKE_PATTERN = Pattern.compile("[^\\.0-9]+");
+
     /**
      * Return s new BasicStroke object with given thickness and style
      * @param code = 3.5 -> thickness=3.5px; 3.5 10 5 -> thickness=3.5px, dashed: 10px filled + 5px empty
      * @return stroke for drawing
      */
     public static Stroke getCustomizedStroke(String code) {
-        String[] s = code.trim().split("[^\\.0-9]+");
+        String[] s = CUSTOMIZED_STROKE_PATTERN.split(code.trim());
 
         if (s.length==0) return new BasicStroke();
         float w;
Index: src/org/openstreetmap/josm/io/CacheFiles.java
===================================================================
--- src/org/openstreetmap/josm/io/CacheFiles.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/CacheFiles.java	(working copy)
@@ -10,6 +10,7 @@
 import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.regex.Pattern;
 
 import javax.imageio.ImageIO;
 
@@ -308,6 +309,9 @@
         return dirsize;
     }
 
+    private static final Pattern IDENT_PATTERN = Pattern.compile("[^a-zA-Z0-9]");
+    private static final Pattern IDENT_PATTERN_2 = Pattern.compile("[acegikmoqsuwy]");
+
     /**
      * Returns a short and unique file name for a given long identifier
      * @return String short filename
@@ -320,8 +324,8 @@
         } catch(Exception e) {
             // Fall back. Remove unsuitable characters and some random ones to shrink down path length.
             // Limit it to 70 characters, that leaves about 190 for the path on Windows/NTFS
-            ident = ident.replaceAll("[^a-zA-Z0-9]", "");
-            ident = ident.replaceAll("[acegikmoqsuwy]", "");
+            ident = IDENT_PATTERN.matcher(ident).replaceAll("");
+            ident = IDENT_PATTERN_2.matcher(ident).replaceAll("");
             return ident.substring(ident.length() - 70);
         }
     }
Index: src/org/openstreetmap/josm/io/MirroredInputStream.java
===================================================================
--- src/org/openstreetmap/josm/io/MirroredInputStream.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/MirroredInputStream.java	(working copy)
@@ -17,6 +17,7 @@
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.List;
+import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
@@ -29,6 +30,7 @@
  * The file mirrored is only downloaded if it has been more than 7 days since last download
  */
 public class MirroredInputStream extends InputStream {
+
     InputStream fs = null;
     File file = null;
 
@@ -55,7 +57,7 @@
      *  - http://... a url. It will be cached on disk.
      * @param destDir the destination directory for the cache file. only applies for urls.
      * @param maxTime the maximum age of the cache file (in seconds)
-     * @throws IOException when the resource with the given name could not be retrieved
+     * @throws java.io.IOException when the resource with the given name could not be retrieved
      */
     public MirroredInputStream(String name, String destDir, long maxTime) throws IOException {
         URL url;
@@ -74,7 +76,7 @@
                     file = checkLocal(url, destDir, maxTime);
                 }
             }
-        } catch (java.net.MalformedURLException e) {
+        } catch (MalformedURLException e) {
             if (name.startsWith("resource://")) {
                 fs = getClass().getResourceAsStream(
                         name.substring("resource:/".length()));
@@ -158,7 +160,7 @@
                 }
                 Main.pref.putCollection(prefKey, null);
             }
-        } catch (java.net.MalformedURLException e) {}
+        } catch (MalformedURLException e) {}
     }
 
     /**
@@ -176,6 +178,8 @@
         return prefKey.toString().replaceAll("=","_");
     }
 
+    private static final Pattern CHECK_LOCAL_PATTERN = Pattern.compile("[^A-Za-z0-9_.-]");
+
     private File checkLocal(URL url, String destDir, long maxTime) throws IOException {
         String prefKey = getPrefKey(url, destDir);
         long age = 0L;
@@ -206,7 +210,7 @@
             destDirFile.mkdirs();
         }
 
-        String a = url.toString().replaceAll("[^A-Za-z0-9_.-]", "_");
+        String a = CHECK_LOCAL_PATTERN.matcher(url.toString()).replaceAll("_");
         String localPath = "mirror_" + a;
         destDirFile = new File(destDir, localPath + ".tmp");
         BufferedOutputStream bos = null;
@@ -254,15 +258,15 @@
      * Opens a connection for downloading a resource.
      * <p>
      * Manually follows redirects because
-     * {@link HttpURLConnection#setFollowRedirects(boolean)} fails if the redirect
+     * {@link java.net.HttpURLConnection#setFollowRedirects(boolean)} fails if the redirect
      * is going from a http to a https URL, see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4620571">bug report</a>.
      * <p>
      * This can causes problems when downloading from certain GitHub URLs.
      * 
      * @param downloadUrl The resource URL to download
      * @return The HTTP connection effectively linked to the resource, after all potential redirections
-     * @throws MalformedURLException If a redirected URL is wrong
-     * @throws IOException If any I/O operation goes wrong
+     * @throws java.net.MalformedURLException If a redirected URL is wrong
+     * @throws java.io.IOException If any I/O operation goes wrong
      * @since 6073
      */
     public static HttpURLConnection connectFollowingRedirect(URL downloadUrl) throws MalformedURLException, IOException {
Index: src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmApi.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/OsmApi.java	(working copy)
@@ -23,6 +23,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.regex.Pattern;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
@@ -73,11 +74,13 @@
      */
     static public final String DEFAULT_API_URL = "http://api.openstreetmap.org/api";
 
+    private static final Pattern API_URL_PATTERN = Pattern.compile(".*openstreetmap.org/api.*");
+
     // The collection of instantiated OSM APIs
     private static HashMap<String, OsmApi> instances = new HashMap<String, OsmApi>();
 
     /**
-     * Replies the {@link OsmApi} for a given server URL
+     * Replies the {@link org.openstreetmap.josm.io.OsmApi} for a given server URL
      *
      * @param serverUrl  the server URL
      * @return the OsmApi
@@ -94,7 +97,7 @@
     }
 
     /**
-     * Replies the {@link OsmApi} for the URL given by the preference <code>osm-server.url</code>
+     * Replies the {@link org.openstreetmap.josm.io.OsmApi} for the URL given by the preference <code>osm-server.url</code>
      *
      * @return the OsmApi
      * @throws IllegalStateException thrown, if the preference <code>osm-server.url</code> is not set
@@ -197,8 +200,8 @@
      * Initializes this component by negotiating a protocol version with the server.
      *
      * @param monitor the progress monitor
-     * @throws OsmTransferCanceledException If the initialisation has been cancelled by user.
-     * @throws OsmApiInitializationException If any other exception occurs. Use getCause() to get the original exception.
+     * @throws org.openstreetmap.josm.io.OsmTransferCanceledException If the initialisation has been cancelled by user.
+     * @throws org.openstreetmap.josm.io.OsmApiInitializationException If any other exception occurs. Use getCause() to get the original exception.
      */
     public void initialize(ProgressMonitor monitor) throws OsmTransferCanceledException, OsmApiInitializationException {
         initialize(monitor, false);
@@ -209,8 +212,8 @@
      *
      * @param monitor the progress monitor
      * @param fastFail true to request quick initialisation with a small timeout (more likely to throw exception)
-     * @throws OsmTransferCanceledException If the initialisation has been cancelled by user.
-     * @throws OsmApiInitializationException If any other exception occurs. Use getCause() to get the original exception.
+     * @throws org.openstreetmap.josm.io.OsmTransferCanceledException If the initialisation has been cancelled by user.
+     * @throws org.openstreetmap.josm.io.OsmApiInitializationException If any other exception occurs. Use getCause() to get the original exception.
      */
     public void initialize(ProgressMonitor monitor, boolean fastFail) throws OsmTransferCanceledException, OsmApiInitializationException {
         if (initialized)
@@ -238,7 +241,7 @@
             /* This is an interim solution for openstreetmap.org not currently
              * transmitting their imagery blacklist in the capabilities call.
              * remove this as soon as openstreetmap.org adds blacklists. */
-            if (this.serverUrl.matches(".*openstreetmap.org/api.*") && capabilities.getImageryBlacklist().isEmpty())
+            if (API_URL_PATTERN.matcher(this.serverUrl).matches() && capabilities.getImageryBlacklist().isEmpty())
             {
                 capabilities.put("blacklist", "regex", ".*\\.google\\.com/.*");
                 capabilities.put("blacklist", "regex", ".*209\\.85\\.2\\d\\d.*");
@@ -332,7 +335,7 @@
      *
      * @param osm the primitive
      * @param monitor the progress monitor
-     * @throws OsmTransferException if something goes wrong
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something goes wrong
      */
     public void createPrimitive(IPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
         String ret = "";
@@ -352,7 +355,7 @@
      *
      * @param osm the primitive. Must not be null.
      * @param monitor the progress monitor
-     * @throws OsmTransferException if something goes wrong
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something goes wrong
      */
     public void modifyPrimitive(IPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
         String ret = null;
@@ -373,7 +376,7 @@
      * Deletes an OSM primitive on the server.
      * @param osm the primitive
      * @param monitor the progress monitor
-     * @throws OsmTransferException if something goes wrong
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something goes wrong
      */
     public void deletePrimitive(IPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
         ensureValidChangeset();
@@ -394,7 +397,7 @@
      *
      * @param changeset the changeset toe be created. Must not be null.
      * @param progressMonitor the progress monitor
-     * @throws OsmTransferException signifying a non-200 return code, or connection errors
+     * @throws org.openstreetmap.josm.io.OsmTransferException signifying a non-200 return code, or connection errors
      * @throws IllegalArgumentException thrown if changeset is null
      */
     public void openChangeset(Changeset changeset, ProgressMonitor progressMonitor) throws OsmTransferException {
@@ -421,9 +424,9 @@
      * be null and id > 0 must be true.
      *
      * @param changeset the changeset to update. Must not be null.
-     * @param monitor the progress monitor. If null, uses the {@link NullProgressMonitor#INSTANCE}.
+     * @param monitor the progress monitor. If null, uses the {@link org.openstreetmap.josm.gui.progress.NullProgressMonitor#INSTANCE}.
      *
-     * @throws OsmTransferException if something goes wrong.
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something goes wrong.
      * @throws IllegalArgumentException if changeset is null
      * @throws IllegalArgumentException if changeset.getId() <= 0
      *
@@ -462,9 +465,9 @@
      * succeeds.
      *
      * @param changeset the changeset to be closed. Must not be null. changeset.getId() > 0 required.
-     * @param monitor the progress monitor. If null, uses {@link NullProgressMonitor#INSTANCE}
+     * @param monitor the progress monitor. If null, uses {@link org.openstreetmap.josm.gui.progress.NullProgressMonitor#INSTANCE}
      *
-     * @throws OsmTransferException if something goes wrong.
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something goes wrong.
      * @throws IllegalArgumentException thrown if changeset is null
      * @throws IllegalArgumentException thrown if changeset.getId() <= 0
      */
@@ -493,7 +496,7 @@
      * @param list the list of changed OSM Primitives
      * @param  monitor the progress monitor
      * @return list of processed primitives
-     * @throws OsmTransferException if something is wrong
+     * @throws org.openstreetmap.josm.io.OsmTransferException if something is wrong
      */
     public Collection<IPrimitive> uploadDiff(Collection<? extends IPrimitive> list, ProgressMonitor monitor) throws OsmTransferException {
         try {
@@ -585,7 +588,7 @@
      * @param fastFail true to request a short timeout
      *
      * @return the body of the HTTP response, if and only if the response code was "200 OK".
-     * @throws OsmTransferException if the HTTP return code was not 200 (and retries have
+     * @throws org.openstreetmap.josm.io.OsmTransferException if the HTTP return code was not 200 (and retries have
      *    been exhausted), or rewrapping a Java exception.
      */
     private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor, boolean doAuthenticate, boolean fastFail) throws OsmTransferException {
@@ -724,7 +727,7 @@
     /**
      * Ensures that the current changeset can be used for uploading data
      *
-     * @throws OsmTransferException thrown if the current changeset can't be used for
+     * @throws org.openstreetmap.josm.io.OsmTransferException thrown if the current changeset can't be used for
      * uploading data
      */
     protected void ensureValidChangeset() throws OsmTransferException {
Index: src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(working copy)
@@ -17,6 +17,7 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Pattern;
 import javax.swing.AbstractAction;
 import javax.swing.JCheckBox;
 
@@ -287,7 +288,9 @@
         findExistingTags();
     }
 
-     /*
+    private static final Pattern ADD_TAGS_PATTERN = Pattern.compile("\\s*=\\s*");
+
+    /*
      * parse addtags parameters Example URL (part):
      * addtags=wikipedia:de%3DResidenzschloss Dresden|name:en%3DDresden Castle
      */
@@ -314,7 +317,7 @@
                         int i = 0;
                         for (String tag : tagSet) {
                             // support a  =   b===c as "a"="b===c"
-                            String [] pair = tag.split("\\s*=\\s*",2);
+                            String [] pair = ADD_TAGS_PATTERN.split(tag, 2);
                             keyValue[i][0] = pair[0];
                             keyValue[i][1] = pair.length<2 ? "": pair[1];
                             i++;
Index: src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(working copy)
@@ -9,6 +9,7 @@
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AutoScaleAction;
@@ -22,7 +23,6 @@
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog;
 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
-import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
 
 /**
  * Adds a way to the current dataset. For instance, {@code /add_way?way=lat1,lon2;lat2,lon2}.
@@ -80,11 +80,14 @@
         return PermissionPrefWithDefault.CREATE_OBJECTS;
     }
 
+    private static final Pattern SPLIT_WAY_PATTERN = Pattern.compile(";\\s*");
+    private static final Pattern COORDINATES_PATTERN = Pattern.compile(",\\s*");
+
     @Override
     protected void validateRequest() throws RequestHandlerBadRequestException {
         allCoordinates.clear();
-        for (String coordinatesString : args.get("way").split(";\\s*")) {
-            String[] coordinates = coordinatesString.split(",\\s*", 2);
+        for (String coordinatesString : SPLIT_WAY_PATTERN.split(args.get("way"))) {
+            String[] coordinates = COORDINATES_PATTERN.split(coordinatesString, 2);
             if (coordinates.length < 2) {
                 throw new RequestHandlerBadRequestException(
                         tr("Invalid coordinates: {0}", Arrays.toString(coordinates)));
Index: src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java
===================================================================
--- src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java	(revision 6099)
+++ src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java	(working copy)
@@ -5,6 +5,7 @@
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.DownloadPrimitiveAction;
@@ -80,10 +81,12 @@
         return PermissionPrefWithDefault.LOAD_DATA;
     }
 
+    private static final Pattern SPLIT_OBJECTS_PATTERN = Pattern.compile(",\\s*");
+
     @Override
     protected void validateRequest() throws RequestHandlerBadRequestException {
         ps.clear();
-        for (String i : args.get("objects").split(",\\s*")) {
+        for (String i : SPLIT_OBJECTS_PATTERN.split(args.get("objects"))) {
             try {
                 ps.add(SimplePrimitiveId.fromString(i));
             } catch (IllegalArgumentException e) {
Index: src/org/openstreetmap/josm/plugins/PluginInformation.java
===================================================================
--- src/org/openstreetmap/josm/plugins/PluginInformation.java	(revision 6099)
+++ src/org/openstreetmap/josm/plugins/PluginInformation.java	(working copy)
@@ -22,6 +22,7 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
+import java.util.regex.Pattern;
 import javax.swing.ImageIcon;
 
 import org.openstreetmap.josm.Main;
@@ -37,6 +38,7 @@
  * @author imi
  */
 public class PluginInformation {
+
     public File file = null;
     public String name = null;
     public int mainversion = 0;
@@ -332,6 +334,8 @@
         }
     }
 
+    private static final Pattern PLUGIN_NAME_PATTERN = Pattern.compile("[-. ]");
+
     /**
      * Try to find a plugin after some criterias. Extract the plugin-information
      * from the plugin and return it. The plugin is searched in the following way:
@@ -369,7 +373,7 @@
      */
     public static PluginInformation findPlugin(String pluginName) throws PluginException {
         String name = pluginName;
-        name = name.replaceAll("[-. ]", "");
+        name = PLUGIN_NAME_PATTERN.matcher(name).replaceAll("");
         InputStream manifestStream = PluginInformation.class.getResourceAsStream("/org/openstreetmap/josm/plugins/"+name+"/MANIFEST.MF");
         if (manifestStream != null)
             return new PluginInformation(manifestStream, pluginName, null);
@@ -441,7 +445,7 @@
      */
     public boolean matches(String filter) {
         if (filter == null) return true;
-        String[] words = filter.split("\\s+");
+        String[] words = Utils.WHITE_SPACES_PATTERN.split(filter);
         for (String word: words) {
             if (matches(word, name)
                     || matches(word, description)
Index: src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java
===================================================================
--- src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java	(revision 6099)
+++ src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java	(working copy)
@@ -12,6 +12,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
@@ -35,6 +36,7 @@
  *
  */
 public class ReadLocalPluginInformationTask extends PleaseWaitRunnable {
+
     private Map<String, PluginInformation> availablePlugins;
     private boolean canceled;
 
@@ -70,12 +72,14 @@
         }
     }
 
+    private static final Pattern SITE_NAME_PATTERN = Pattern.compile("^([0-9]+-)?site.*\\.txt$");
+
     protected void scanSiteCacheFiles(ProgressMonitor monitor, File pluginsDirectory) {
         File[] siteCacheFiles = pluginsDirectory.listFiles(
                 new FilenameFilter() {
                     @Override
                     public boolean accept(File dir, String name) {
-                        return name.matches("^([0-9]+-)?site.*\\.txt$");
+                        return SITE_NAME_PATTERN.matcher(name).matches();
                     }
                 }
         );
@@ -96,12 +100,14 @@
         }
     }
 
+    private static final Pattern ICON_NAME_PATTERN = Pattern.compile("^([0-9]+-)?site.*plugin-icons\\.zip$");
+
     protected void scanIconCacheFiles(ProgressMonitor monitor, File pluginsDirectory) {
         File[] siteCacheFiles = pluginsDirectory.listFiles(
                 new FilenameFilter() {
                     @Override
                     public boolean accept(File dir, String name) {
-                        return name.matches("^([0-9]+-)?site.*plugin-icons\\.zip$");
+                        return ICON_NAME_PATTERN.matcher(name).matches();
                     }
                 }
         );
Index: src/org/openstreetmap/josm/tools/LanguageInfo.java
===================================================================
--- src/org/openstreetmap/josm/tools/LanguageInfo.java	(revision 6099)
+++ src/org/openstreetmap/josm/tools/LanguageInfo.java	(working copy)
@@ -2,8 +2,10 @@
 package org.openstreetmap.josm.tools;
 
 import java.util.Locale;
+import java.util.regex.Pattern;
 
 public class LanguageInfo {
+
     /**
      * Type of the locale to use
      * @since 5915
@@ -19,13 +21,15 @@
         ENGLISH
     };
 
+    private static final Pattern WL_PREFFIX_PATTERN = Pattern.compile("[^_]+_[^_]+");
+
     /**
      * Replies the wiki language prefix for the given locale. The wiki language
      * prefix has the form 'Xy:' where 'Xy' is a ISO 639 language code in title
      * case (or Xy_AB: for sub languages).
      *
      * @param type the type
-     * @return the wiki language prefix or {@code null} for {@link LocaleType#BASELANGUAGE}, when
+     * @return the wiki language prefix or {@code null} for {@link org.openstreetmap.josm.tools.LanguageInfo.LocaleType#BASELANGUAGE}, when
      * base language is identical to default or english
      * @since 5915
      */
@@ -35,7 +39,7 @@
 
         String code = getJOSMLocaleCode();
         if(type == LocaleType.BASELANGUAGE) {
-            if(code.matches("[^_]+_[^_]+")) {
+            if(WL_PREFFIX_PATTERN.matcher(code).matches()) {
                 code = code.substring(0,2);
                 if(code == "en")
                     return null;
@@ -51,8 +55,8 @@
      * Replies the wiki language prefix for the current locale.
      *
      * @return the wiki language prefix
-     * @see Locale#getDefault()
-     * @see #getWikiLanguagePrefix(LocaleType)
+     * @see java.util.Locale#getDefault()
+     * @see #getWikiLanguagePrefix(org.openstreetmap.josm.tools.LanguageInfo.LocaleType)
      */
     static public String getWikiLanguagePrefix() {
         return getWikiLanguagePrefix(LocaleType.DEFAULT);
@@ -62,7 +66,7 @@
      * Replies the JOSM locale code for the default locale.
      *
      * @return the JOSM locale code for the default locale
-     * @see #getJOSMLocaleCode(Locale)
+     * @see #getJOSMLocaleCode(java.util.Locale)
      */
     static public String getJOSMLocaleCode() {
         return getJOSMLocaleCode(Locale.getDefault());
@@ -71,9 +75,9 @@
     /**
      * Replies the locale code used by JOSM for a given locale.
      *
-     * In most cases JOSM uses the 2-character ISO 639 language code ({@link Locale#getLanguage()}
+     * In most cases JOSM uses the 2-character ISO 639 language code ({@link java.util.Locale#getLanguage()}
      * to identify the locale of a localized resource, but in some cases it may use the
-     * programmatic name for locales, as replied by {@link Locale#toString()}.
+     * programmatic name for locales, as replied by {@link java.util.Locale#toString()}.
      *
      * @param locale the locale. Replies "en" if null.
      * @return the JOSM code for the given locale
Index: src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- src/org/openstreetmap/josm/tools/Utils.java	(revision 6099)
+++ src/org/openstreetmap/josm/tools/Utils.java	(working copy)
@@ -32,6 +32,7 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.regex.Pattern;
 import java.util.zip.ZipFile;
 
 import org.openstreetmap.josm.Main;
@@ -42,6 +43,9 @@
  */
 public class Utils {
 
+    public static final Pattern WHITE_SPACES_PATTERN = Pattern.compile("\\s+");
+    public static final Pattern DIGITS_PATTERN = Pattern.compile("\\D+");
+
     public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) {
         for (T item : collection) {
             if (predicate.evaluate(item))
@@ -245,7 +249,7 @@
      * Taken from <a href="http://www.rgagnon.com/javadetails/java-0064.html">this article</a> (CC-NC-BY-SA)
      * @param in The source file
      * @param out The destination file
-     * @throws IOException If any I/O error occurs
+     * @throws java.io.IOException If any I/O error occurs
      */
     public static void copyFile(File in, File out) throws IOException  {
         // TODO: remove this function when we move to Java 7 (use Files.copy instead)
@@ -293,7 +297,7 @@
     }
 
     /**
-     * <p>Utility method for closing a {@link Closeable} object.</p>
+     * <p>Utility method for closing a {@link java.io.Closeable} object.</p>
      *
      * @param c the closeable object. May be null.
      */
@@ -307,7 +311,7 @@
     }
 
     /**
-     * <p>Utility method for closing a {@link ZipFile}.</p>
+     * <p>Utility method for closing a {@link java.util.zip.ZipFile}.</p>
      *
      * @param zip the zip file. May be null.
      */
@@ -476,7 +480,7 @@
 
     /**
      * Transforms the collection {@code c} into an unmodifiable collection and
-     * applies the {@link Function} {@code f} on each element upon access.
+     * applies the {@link org.openstreetmap.josm.tools.Utils.Function} {@code f} on each element upon access.
      * @param <A> class of input collection
      * @param <B> class of transformed collection
      * @param c a collection
@@ -518,7 +522,7 @@
 
     /**
      * Transforms the list {@code l} into an unmodifiable list and
-     * applies the {@link Function} {@code f} on each element upon access.
+     * applies the {@link org.openstreetmap.josm.tools.Utils.Function} {@code f} on each element upon access.
      * @param <A> class of input collection
      * @param <B> class of transformed collection
      * @param l a collection
@@ -561,15 +565,17 @@
         return new Color(Integer.parseInt(clr, 16));
     }
 
+    private static final Pattern HTTP_PREFFIX_PATTERN = Pattern.compile("https?");
+
     /**
      * Opens a HTTP connection to the given URL and sets the User-Agent property to JOSM's one.
      * @param httpURL The HTTP url to open (must use http:// or https://)
      * @return An open HTTP connection to the given URL
-     * @throws IOException if an I/O exception occurs.
+     * @throws java.io.IOException if an I/O exception occurs.
      * @since 5587
      */
     public static HttpURLConnection openHttpConnection(URL httpURL) throws IOException {
-        if (httpURL == null || !httpURL.getProtocol().matches("https?")) {
+        if (httpURL == null || !HTTP_PREFFIX_PATTERN.matcher(httpURL.getProtocol()).matches()) {
             throw new IllegalArgumentException("Invalid HTTP url");
         }
         HttpURLConnection connection = (HttpURLConnection) httpURL.openConnection();
@@ -581,7 +587,7 @@
      * Opens a connection to the given URL and sets the User-Agent property to JOSM's one.
      * @param url The url to open
      * @return An stream for the given URL
-     * @throws IOException if an I/O exception occurs.
+     * @throws java.io.IOException if an I/O exception occurs.
      * @since 5867
      */
     public static InputStream openURL(URL url) throws IOException {
@@ -607,7 +613,7 @@
      * Opens a connection to the given URL and sets the User-Agent property to JOSM's one.
      * @param url The url to open
      * @return An buffered stream reader for the given URL (using UTF-8)
-     * @throws IOException if an I/O exception occurs.
+     * @throws java.io.IOException if an I/O exception occurs.
      * @since 5868
      */
     public static BufferedReader openURLReader(URL url) throws IOException {
@@ -619,7 +625,7 @@
      * @param httpURL The HTTP url to open (must use http:// or https://)
      * @param keepAlive
      * @return An open HTTP connection to the given URL
-     * @throws IOException if an I/O exception occurs.
+     * @throws java.io.IOException if an I/O exception occurs.
      * @since 5587
      */
     public static HttpURLConnection openHttpConnection(URL httpURL, boolean keepAlive) throws IOException {
