*/
package mir.util;
-import gnu.regexp.RE;
+import org.apache.oro.text.regex.*;
import java.util.ArrayList;
import java.util.List;
return result.toString();
}
- /**
- */
public static String replaceEscapedStringCharacters(String aText, char anEscapeCharacter, char[] aCharactersToReplace, String[] aStringsToSubstitute) {
if (aText==null)
public static String performRegularExpressionReplacement(String aSource, String aSearchExpression, String aReplacement) {
try {
- RE regularExpression;
-
- regularExpression = new RE(aSearchExpression);
+ Pattern pattern = new Perl5Compiler().compile(aSearchExpression);
- return regularExpression.substituteAll(aSource, aReplacement);
+ return Util.substitute(
+ new Perl5Matcher(), pattern, new Perl5Substitution(aReplacement), aSource, Util.SUBSTITUTE_ALL);
}
- catch (Throwable t) {
- throw new UtilFailure("StringRoutines.performRegularExpressionReplacement: " + t.toString(), t);
+ catch (MalformedPatternException t) {
+ throw new UtilFailure("Invalid regular expression", t);
}
}