2 // This software is now distributed according to
3 // the Lesser Gnu Public License. Please see
4 // http://www.gnu.org/copyleft/lesser.txt for
8 package com.stevesoft.pat;
11 * This method implements the pattern elements $1, $2, etc in a substitution
12 * rule. The apply(StringBufferLike sb,RegRes rr) method of this ReplaceRule
13 * simply appends the contents of rr.stringMatched(n), where n is the integer
14 * supplied to the constructor.
16 public class BackRefRule extends ReplaceRule
20 public BackRefRule(int n)
25 public void apply(StringBufferLike sb, RegRes res)
27 String x = res.stringMatched(n);
28 sb.append(x == null ? "" : x);
31 public String toString1()
36 public Object clone1()
38 return new BackRefRule(n);