JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / util / UrlLink.java
index 8a60b56..0141a6a 100644 (file)
@@ -35,8 +35,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
-import com.stevesoft.pat.Regex;
-
 /**
  * A helper class to parse URL Link strings taken from applet parameters or
  * jalview properties file using the com.stevesoft.pat.Regex implementation.
@@ -304,7 +302,8 @@ public class UrlLink
     {
       if (regexReplace != null)
       {
-        Regex rg = Platform.newRegexPerl("/" + regexReplace + "/");
+        com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex
+                .perlCode("/" + regexReplace + "/");
         if (rg.search(idstring))
         {
           int ns = rg.numSubs();
@@ -508,8 +507,21 @@ public class UrlLink
     {
       // Extract Regex and suffix
       urlSuffix = link.substring(p + endDelimiter.length());
-      testRegexPerl(
-              regexReplace = link.substring(sqidPos + startLength, p));
+      regexReplace = link.substring(sqidPos + startLength, p);
+      try
+      {
+        com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex
+                .perlCode("/" + regexReplace + "/");
+        if (rg == null)
+        {
+          invalidMessage = "Invalid Regular Expression : '" + regexReplace
+                  + "'\n";
+        }
+      } catch (Exception e)
+      {
+        invalidMessage = "Invalid Regular Expression : '" + regexReplace
+                + "'\n";
+      }
     }
     else
     {
@@ -538,21 +550,6 @@ public class UrlLink
     return p;
   }
 
-  private void testRegexPerl(String r)
-  {
-    Regex rg = null;
-    try
-    {
-      rg = Platform.newRegexPerl("/" + r + "/");
-    } catch (Exception e)
-    {
-    }
-    if (rg == null)
-    {
-      invalidMessage = "Invalid Regular Expression : '" + r + "'\n";
-    }
-  }
-
   /**
    * Create a set of URL links for a sequence
    *