JAL-3210 Improvements to eclipse detection. New src tree and SwingJS updated from...
[jalview.git] / src / jalview / ws / dbsources / EmblSource.java
index 6bbe2e1..ec75b04 100644 (file)
@@ -22,6 +22,7 @@ package jalview.ws.dbsources;
 
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefSource;
+import jalview.util.Platform;
 
 import com.stevesoft.pat.Regex;
 
@@ -32,6 +33,8 @@ import com.stevesoft.pat.Regex;
 public class EmblSource extends EmblXmlSource
 {
 
+  private static Regex ACCESSION_REGEX;
+
   public EmblSource()
   {
     super();
@@ -57,7 +60,11 @@ public class EmblSource extends EmblXmlSource
   @Override
   public Regex getAccessionValidator()
   {
-    return new Regex("^[A-Z]+[0-9]+");
+    if (ACCESSION_REGEX == null)
+    {
+      ACCESSION_REGEX = Platform.newRegex("^[A-Z]+[0-9]+", null);
+    }
+    return ACCESSION_REGEX;
   }
 
   /*