From 02a721469b0aa9d336db4e3b243250ba0eb9d372 Mon Sep 17 00:00:00 2001 From: Charles Ofoegbu Date: Thu, 27 Nov 2014 09:20:45 +0000 Subject: [PATCH] modified regex for sequence validation --- src/jalview/ws/jws2/MsaWSClient.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index d9452a3..c3661c3 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -199,8 +199,7 @@ public class MsaWSClient extends Jws2Client for (SequenceI seq : seqs) { - if (seq.getSequenceAsString().matches( - "([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?")) + if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){3}[a-zA-Z-]*")) { ++validSeqCount; } @@ -213,7 +212,7 @@ public class MsaWSClient extends Jws2Client JOptionPane .showMessageDialog( alignFrame, - "A minimum of two sequences with at least one non-gap character \nin each sequence is required to perform this operation", + "A minimum of two sequences with at least three non-gap character \nis required to perform this operation", "Invalid selection", JOptionPane.INFORMATION_MESSAGE); return false; @@ -221,9 +220,7 @@ public class MsaWSClient extends Jws2Client public static void main(String[] args) { - System.out - .println("A" - .matches("([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?")); + System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")); } -- 1.7.10.2