TUM CCSM Commons

edu.tum.cs.commons.string
Class RegexReplacementProcessor

java.lang.Object
  extended by edu.tum.cs.commons.string.RegexReplacementProcessor

public class RegexReplacementProcessor
extends java.lang.Object

This class allows the application of multiplex IRegexReplacements to a string.

Version:
$Rev: 26283 $
Author:
Florian Deissenboeck, $Author: juergens $
Rating:
GREEN Hash: 34CDDB3007890E0011169AE24AE44CA9

Constructor Summary
RegexReplacementProcessor(java.util.List<IRegexReplacement> expressions)
          Create a new replacement processor.
 
Method Summary
 java.lang.String process(java.lang.String text)
          Apply replacements to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexReplacementProcessor

public RegexReplacementProcessor(java.util.List<IRegexReplacement> expressions)
Create a new replacement processor.

Method Detail

process

public java.lang.String process(java.lang.String text)
                         throws java.util.regex.PatternSyntaxException
Apply replacements to a string.

Returns:
the input string after the application of all replacements or the a copy of the input string if the list of replacements is empty.
Throws:
java.util.regex.PatternSyntaxException - unfortunately method Matcher.replaceAll(java.lang.String) throws an IndexOutOfBoundsException if a non-existent capturing group is referenced. This method converts this exception to a PatternSyntaxException.

TUM CCSM Commons

TUM CCSM Commons - 2.7