From: Ben Soares Date: Mon, 28 Jan 2019 10:53:32 +0000 (+0000) Subject: JAL-3141 improvement on BackupFilenameParts filename matching X-Git-Tag: Release_2_11_0~17^2~97^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2c6e8912516541ca2a380c3bb35a656fe7afdab2;p=jalview.git JAL-3141 improvement on BackupFilenameParts filename matching --- diff --git a/src/jalview/io/BackupFilenameParts.java b/src/jalview/io/BackupFilenameParts.java index a4fbb3b..4f93ece 100644 --- a/src/jalview/io/BackupFilenameParts.java +++ b/src/jalview/io/BackupFilenameParts.java @@ -93,7 +93,11 @@ public class BackupFilenameParts if (filename.length() >= startLength + digits + endLength && filename.startsWith(base + templateStart) && filename.endsWith(templateEnd) - && numString.matches("[0-9]*")) + // match exactly digits number of number-characters (numString + // should be all digits and at least the right length), or more than + // digits long with proviso it's not zero-leading. + && (numString.matches("[0-9]{" + digits + "}") + || numString.matches("[1-9][0-9]{" + digits + ",}"))) { this.base = extensionMatch ? savedFilename + base : base; this.templateStart = templateStart;