import org.apache.oro.text.regex.Perl5Substitution;
import org.apache.oro.text.regex.Util;
import org.apache.oro.text.regex.Perl5Compiler;
+import org.apache.oro.text.regex.MalformedPatternException;
import java.text.NumberFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
+import mir.util.UtilFailure;
+
/**
*/
public final class StringUtil {
return calendar.getTime();
}
- public static String regexpReplace(String anInput, String anExpression, String aReplacement) throws Exception {
+ public static String regexpReplace(String anInput, String anExpression, String aReplacement) throws UtilFailure {
Perl5Matcher matcher = new Perl5Matcher();
- return Util.substitute(
- matcher, new Perl5Compiler().compile(anExpression),
- new Perl5Substitution(aReplacement), anInput,
- Util.SUBSTITUTE_ALL);
- }
-
-
-
-}
+ try {
+ return Util.substitute(
+ matcher, new Perl5Compiler().compile(anExpression),
+ new Perl5Substitution(aReplacement), anInput,
+ Util.SUBSTITUTE_ALL);
+ }
+ catch (MalformedPatternException e) {
+ throw new UtilFailure(e);
+ }
+ }
+}
\ No newline at end of file