The Matcher.appendReplacement method has a great example of how to efficiently replace matched text in a loop:
Pattern p = Pattern.compile("cat"); Matcher m = p.matcher("one cat two cats in the yard"); StringBuffer sb = new StringBuffer(); while (m.find()) { m.appendReplacement(sb, "dog"); } m.appendTail(sb); System.out.println(sb.toString()); (see http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Matcher.html) What's the corresponding code using the RE class? Should Regexp include a corresponding example in its documentation? (see http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html) Thanks, -- Kevin Rodgers --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]