// arg0 should *not* be interpreted as a RegExp
return StringUtils.replaceOnce(thisString, (String) arg0, replacement);
}
else if (arg0 instanceof NativeRegExp) {
try {
final NativeRegExp regexp = (NativeRegExp) arg0;
final RegExpData reData = new RegExpData(regexp);
final String regex = reData.getJavaPattern();
final int flags = reData.getJavaFlags();
final Pattern pattern = Pattern.compile(regex, flags);
final Matcher matcher = pattern.matcher(thisString);