+ protected String regex(String source, String regex) {
+ Matcher matcher = Pattern.compile(regex, Pattern.MULTILINE).matcher(source);
+ if (matcher.find()) {
+ return matcher.groupCount() > 0 ? matcher.group(1) : matcher.group();
+ }
+ return null;
+ }
+
+ protected boolean isPgnFormat(String source) {
+ return regex(source, PGN_DETECT_REGEX) != null;
+ }
+