class RegexRule
extends BaseRule {

    private static final long serialVersionUID = -3L;

    protected static Logger logger =
        Logger.getLogger(BaseRule.class.getName());

//    private static final String DESCRIPTION = "General regex rule. " +
//        "Specify a matching regex and a format string used outputting" +
//        " result if a match was found.  If problem compiling regex or" +
//        " interpreting format, problem is logged, and this rule does" +
//        " nothing.  See User Manual for example usage.";

    
    {
        setRegex(Pattern.compile("(.*)"));
    }
    public Pattern getRegex() {
        return (Pattern) kp.get("regex");
    }
    /**
     * The regular expression to use to match.
     */
    public void setRegex(Pattern regex) {
        kp.put("regex",regex);
    }
    
    {
        setFormat("$1");
    }
    public String getFormat() {
        return (String) kp.get("format");
    }
    /**
     * The format string to use when a match is found.
     */
    public void setFormat(String format) {
        kp.put("format",format);
    }

    public RegexRule() {
    }
    

    public String canonicalize(String url) {<FILL_FUNCTION_BODY>}
}

        Pattern pattern = getRegex();
        Matcher matcher = pattern.matcher(url);
        if (!matcher.matches()) {
            return url;
        }
        StringBuffer buffer = new StringBuffer(url.length() * 2);
        matcher.appendReplacement(buffer,getFormat());
        return buffer.toString();
    
<methods>public void <init>() ,public boolean getEnabled() ,public org.archive.spring.KeyedProperties getKeyedProperties() ,public void setEnabled(boolean) <variables>protected org.archive.spring.KeyedProperties kp,private static final long serialVersionUID