code: protected String findAll(String strPattern, String text, int grp,
        String separator) {
  
      String retval = "";
      boolean firstTime = true;
  
      Pattern pattern = Pattern.compile(strPattern);
      Matcher matcher = pattern.matcher(text);
  
      while (matcher.find()) {
        retval += (firstTime ? "" : separator) + matcher.group(grp);
        firstTime = false;
      }
  
      return retval;
    }
docs: Finds all occurences of a pattern in a piece of text and returns
  the matching groups.
  
  @param strPattern the regular expression to match
  @param text the text to search
  @param grp the number of the matching group to return
  @param separator the string that separates occurences in the returned value
  
  @return a String that contains all occurences of strPattern in text,
  separated by separator