public class Matcher
{
    public Matcher (Rule[] rules, boolean debug)
    {
        _rules = rules;
        _debug = debug;
    }

    public Message[] matchRule (int ruleNumber, Message[] messages)
    {
        Rule ruleToMatch = _rules[ruleNumber];

        //if (_debug)
            System.out.println("Trying to match rule: "+ruleToMatch);

        String current = getMatchingString(ruleToMatch, "", true);

        System.out.println("Match using first rules: "+current);

        current = getMatchingString(ruleToMatch, "", false);

        System.out.println("Match using second rules: "+current);

        return null;
    }

    private String getMatchingString (Rule theRule, String current, boolean checkFirst)
    {
        String str = current;

        System.out.println("Looking to match "+theRule);

        if (theRule.getMatch() == Rule.NO_MATCH)
        {
            if (checkFirst)
            {
                int[] firstRules = theRule.firstDependantRules();

                for (int i = 0; i < firstRules.length; i++)
                {
                    str = getMatchingString(_rules[firstRules[i]], str, true);

                    //if (_debug)
                        System.out.println("First rules string: "+str);
                }
            }
            else
            {
                int[] secondRules = theRule.secondDependantRules();

                if (secondRules != null)
                {
                    for (int i = 0; i < secondRules.length; i++)
                    {
                        str = getMatchingString(_rules[secondRules[i]], str, false);

                        //if (_debug)
                            System.out.println("Second rules string: "+str);
                    }
                }
            }
        }
        else
            str += theRule.getMatch();

        return str;
    }

    private Rule[] _rules;
    private boolean _debug;
}
@@ -1,12 +1,33 @@
+import java.util.*;%0A%0A
 public class
@@ -267,16 +267,73 @@
 Number%5D;
+%0A        Vector%3CMessage%3E toMatch = new Vector%3CMessage%3E();
 %0A%0A      
@@ -545,32 +545,76 @@
 s: %22+current);%0A%0A
+        toMatch.add(new Message(current));%0A%0A
         current 
@@ -651,32 +651,84 @@
 h, %22%22, false);%0A%0A
+        toMatch.add(new Message(current));%0A        %0A
         System.o

Update Matcher.java