package org.hedgecode.chess.scanner.portal;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.hedgecode.chess.scanner.ChessHogScannerException;
import org.hedgecode.chess.scanner.Initiable;
import org.hedgecode.chess.scanner.Settings;
import org.hedgecode.chess.scanner.regex.RegexParams;
import org.hedgecode.chess.scanner.spi.ServiceRegistry;
+import static org.hedgecode.chess.scanner.ChessHogScannerConstants.*;
import static org.hedgecode.chess.scanner.regex.RegexBuilder.Type;
/**
);
}
+ 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;
+ }
+
private String assignUrlWithParams(String url, String params) {
return params != null
? url.concat(params)