public boolean matches(String s, String t, HashMap<String, TreeSet<String>> m) throws Exception {
    if (!defs.containsKey(s))
      throw new Exception("Error: symbol <" + s + "> not defined.");
    
    //remove all non-word characters 0-9, a-z, A-Z, then split into tokens
    Vector<String> tTokens = new Vector<String>(
                                  Arrays.asList(t.replaceAll("[.,!@#$%^&*()]", "").split("\\s+")));
    recursedTooDeep = false;
    searchedTooLong = false;
    results = m;
    startTime = System.nanoTime();
    int endidx = match(defs.get(s), tTokens, 0, 0);
    if (recursedTooDeep)
      throw new Exception("Note: Some searches terminated early due too recursion too deep.");
    if (searchedTooLong)
      throw new Exception("Note: Search took too long and was terminated early.");
    if (endidx == tTokens.size()) {
      String toks = vectorToStr(tTokens, 0, tTokens.size());
      if (results.get(s) == null) results.put(s, new TreeSet<String>());
      results.get(s).add(toks);
    }
    return endidx == tTokens.size();
  }