package org.joverseer.support;

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;
/**
 * Filter files matching the specified game
 * @author Dave
 *
 */
public class XmlAndPdfFileFilter implements FileFilter {
	String gameNoAsString;
	public XmlAndPdfFileFilter(int gameNo) {
		this.gameNoAsString = String.format("g%03d", gameNo);
	}
	@Override
	public boolean accept(File file) {
		String name = file.getName();
		return (!file.isDirectory()) && name.contains(this.gameNoAsString) &&
				((name.endsWith(".pdf") ||
				(Pattern.matches("g\\d{3}n\\d{2}t\\d{3}.xml", name) )));
	}
}
@@ -357,10 +357,8 @@
 (%22g%25
-03
 d%22, 
@@ -589,23 +589,26 @@
 %5C%5Cd%7B
-3
+2,
 %7Dn%5C%5Cd%7B2
+,
 %7Dt%5C%5Cd%7B
-3
+2,
 %7D.xm

Allow 4 digit game numbers