Merge branch 'Jalview-JS/develop' into merge_js_develop
[jalview.git] / src / jalview / ws / dbsources / Pdb.java
index a658089..8951a6e 100644 (file)
@@ -36,6 +36,7 @@ import jalview.io.FormatAdapter;
 import jalview.io.PDBFeatureSettings;
 import jalview.structure.StructureImportSettings;
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 import jalview.ws.ebi.EBIFetchClient;
 
 import java.io.File;
@@ -56,6 +57,8 @@ public class Pdb extends EbiFileRetrievedProxy
 
   private static final int PDB_ID_LENGTH = 4;
 
+  private static Regex ACCESSION_REGEX;
+
   public Pdb()
   {
     super();
@@ -80,7 +83,12 @@ public class Pdb extends EbiFileRetrievedProxy
   @Override
   public Regex getAccessionValidator()
   {
-    return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");
+    if (ACCESSION_REGEX == null)
+    {
+      ACCESSION_REGEX = Platform
+              .newRegex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");
+    }
+    return ACCESSION_REGEX;
   }
 
   /*