buf = new StringBuffer(chars.length);
buf = new StringBuffer(length);
	public String substitute(String text)	{		StringBuffer buf = null;		char[] chars = text.toCharArray();		int pos, lastMatch = 0;		while ((pos = match(chars, lastMatch)) != -1)		{			if (buf == null)			{				buf = new StringBuffer(chars.length);			}			if (pos != lastMatch)			{				buf.append(chars, lastMatch, pos - lastMatch);			}			buf.append(replace);			lastMatch = pos + pattern.length;		}		if(buf == null)		{			return null;		}		else		{			if(lastMatch < chars.length)			{				buf.append(chars, lastMatch,					chars.length - lastMatch);			}			return buf.toString();		}	}