public class test { public static void main(String[] args) { String s = "HBK.THEMIS_E.TLM_VC2.2007_101_022200.dat"; System.out.println(s.matches("HBK[.]THEMIS_[A-E][.]TLM_VC[0-6][.]\\d{4}_\\d{3}_\\d{6}[.]dat")); /* int first; int last; int total; int calc; int mod = (int) Math.pow(2,14); System.out.println("mod: " + mod); int missing; first = 15931; last = 1894; total = 2348; if(last < first) { last+=mod; System.out.println("Recalc Last: " + last); } //not sure this 1 should be here calc=last-first+1; System.out.println("Calc: " + calc); //calc = last-first; //this calculation rarely comes into play because the //number of packets in a file is normally small //but it ensures we are working with the greatest possible //value of calc less than the total //also this example is deprecated mod is not 65536 //example:total is 65538 //first is 0 //last is 1 //calc is 2 //this calculation makes calc = 2 + (1*mod) = 65538 //and it passes if(calc<=total-mod) { //this is integral not floating point division calc += (total/mod) * mod; } if(calc==total) { System.out.println("succeed 1"); } else { missing = calc-total; System.out.println("The file was missing at least " + missing + " packets or " + (((float)missing)/((float)total))*100 + "% of that apid"); System.out.println("fail"); } */ //System.out.println("succeed 2"); } } public class test { public static void main(String[] args) { String s = "HBK.THEMIS_E.TLM_VC2.2007_101_022200.dat"; System.out.println(s.matches("HBK[.]THEMIS_[A-E][.]TLM_VC[0-6][.]\\d{4}_\\d{3}_\\d{6}[.]dat")); /* int first; int last; int total; int calc; int mod = (int) Math.pow(2,14); System.out.println("mod: " + mod); int missing; first = 15931; last = 1894; total = 2348; if(last < first) { last+=mod; System.out.println("Recalc Last: " + last); } //not sure this 1 should be here calc=last-first+1; System.out.println("Calc: " + calc); //calc = last-first; //this calculation rarely comes into play because the //number of packets in a file is normally small //but it ensures we are working with the greatest possible //value of calc less than the total //also this example is deprecated mod is not 65536 //example:total is 65538 //first is 0 //last is 1 //calc is 2 //this calculation makes calc = 2 + (1*mod) = 65538 //and it passes if(calc<=total-mod) { //this is integral not floating point division calc += (total/mod) * mod; } if(calc==total) { System.out.println("succeed 1"); } else { missing = calc-total; System.out.println("The file was missing at least " + missing + " packets or " + (((float)missing)/((float)total))*100 + "% of that apid"); System.out.println("fail"); } */ //System.out.println("succeed 2"); } }