[MOBY-guts] biomoby commit
Eddie Kawas
kawas at pub.open-bio.org
Tue Oct 11 20:31:27 UTC 2005
kawas
Tue Oct 11 16:31:27 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/util
In directory pub.open-bio.org:/tmp/cvs-serv11209/org/biomoby/client/ui/graphical/applets/util
Modified Files:
REGEXP.java
Log Message:
fixed a bug where a URI that contained a '-', ie www.my-uri.com, was rejected.
moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/util REGEXP.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/util/REGEXP.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/util/REGEXP.java 2005/04/07 16:42:27 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/util/REGEXP.java 2005/10/11 20:31:27 1.2
@@ -21,7 +21,8 @@
private final static String URI =
//"(^(http:\\/\\/www\\.|HTTP:\\/\\/www\\.|www\\.|http:\\/\\/|HTTP:\\/\\/)?[\\w]+\\.[\\w].*\\w$)";
//"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"; // as per rfc 2396 appendix a.
- "^([\\w]+\\.[\\w]+(\\.[\\w]+)*)$";
+ //"^([\\w]+\\.[\\w]+(\\.[\\w]+)*)$";
+ "^([\\w]{1}[\\d\\w\\-]+\\.[\\d\\w\\-]+(\\.[\\d\\w]{2,})*)$";
private final static String URL =
"(^(http:\\/\\/www\\.|HTTP:\\/\\/www\\.|http:\\/\\/|HTTP:\\/\\/)[\\w]+\\.[\\w].*(\\/\\w+(\\.{1}\\w+)*)$)";
@@ -44,7 +45,11 @@
public static boolean isValidURI(String uri) {
Pattern p = Pattern.compile(URI);
Matcher m = p.matcher(uri);
- return m.matches();
+ boolean matches = m.matches();
+ p = Pattern.compile("(\\-{2,})");
+ m = p.matcher(uri);
+ matches = matches && !m.matches();
+ return matches;
}
/**
More information about the MOBY-guts
mailing list