class PageKeyFilter extends AbstractFilter<URL> {

    private String key;
    private boolean regex;



    public PageKeyFilter(String key, boolean regex) {
        this(null, key, regex);
    }


    /**
     * @param strategy 超时等待策略（null则设置为默认等待策略）
     * @param key 关键字
     * @param regex 是否启用正则表达式
     */
    public PageKeyFilter(TimeWaitingStrategy strategy, String key, boolean regex) {
        super(strategy);
        this.key = key;
        this.regex = regex;
    }

    @Override
    protected boolean filterLogic(URL url) throws Exception {<FILL_FUNCTION_BODY>}
}

        if (url == null) return false;

        String pageContent = request(url);
        boolean res;

        if(regex) {
            Pattern pattern = Pattern.compile(key);
            Matcher matcher = pattern.matcher(pageContent);
            res = matcher.find();
        } else res = pageContent.contains(key);

        return res;
    
<methods>public void <init>(org.decaywood.timeWaitingStrategy.TimeWaitingStrategy) ,public void <init>(org.decaywood.timeWaitingStrategy.TimeWaitingStrategy, java.lang.String) ,public boolean test(java.net.URL) <variables>