String logLine = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:[^:]+:([^:]+):(.*)"; valid = Pattern.compile(logLine);
String logLine13 = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:([^:]+):(.*)"; String logLine14 = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:[^:]+:([^:]+):(.*)"; valid13 = Pattern.compile(logLine13); valid14 = Pattern.compile(logLine14);
    public static void setRegex(String fileTemplate)    {        // build the exclude characters regular expression        StringBuffer charRegEx = new StringBuffer();        charRegEx.append("[");        for (int i = 0; i < excludeChars.size(); i++)        {            charRegEx.append("\\" + (String) excludeChars.get(i));        }        charRegEx.append("]");        excludeCharRX = Pattern.compile(charRegEx.toString());                // regular expression to find handle indicators in strings        handleRX = Pattern.compile("handle=");                // regular expression to find item_id indicators in strings        itemRX = Pattern.compile(",item_id=.*$");                // regular expression to find query indicators in strings        queryRX = Pattern.compile("query=");                // regular expression to find collections in strings        collectionRX = Pattern.compile("collection_id=[0-9]*,");                // regular expression to find communities in strings        communityRX = Pattern.compile("community_id=[0-9]*,");                // regular expression to find search result sets        resultsRX = Pattern.compile(",results=(.*)");                // regular expressions to find single characters anywhere in the string        singleRX = Pattern.compile("( . |^. | .$)");                // set up the standard log file line regular expression        String logLine = "^(\\d\\d\\d\\d-\\d\\d\\-\\d\\d) \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d (\\w+)\\s+\\S+ @ ([^:]+):[^:]+:[^:]+:([^:]+):(.*)";        valid = Pattern.compile(logLine);                // set up the pattern for validating log file names        logRegex = Pattern.compile(fileTemplate);                // set up the pattern for matching any of the query types        StringBuffer typeRXString = new StringBuffer();        typeRXString.append("(");        for (int i = 0; i < excludeTypes.size(); i++)        {            if (i > 0)            {                typeRXString.append("|");            }            typeRXString.append((String) excludeTypes.get(i));        }        typeRXString.append(")");        typeRX = Pattern.compile(typeRXString.toString());                // set up the pattern for matching any of the words to exclude        StringBuffer wordRXString = new StringBuffer();        wordRXString.append("(");        for (int i = 0; i < excludeWords.size(); i++)        {            if (i > 0)            {                wordRXString.append("|");            }            wordRXString.append(" " + (String) excludeWords.get(i) + " ");            wordRXString.append("|");            wordRXString.append("^" + (String) excludeWords.get(i) + " ");            wordRXString.append("|");            wordRXString.append(" " + (String) excludeWords.get(i) + "$");        }        wordRXString.append(")");        wordRX = Pattern.compile(wordRXString.toString());                return;    }