TUM CCSM Commons

edu.tum.cs.commons.string
Class RegexReplacement

java.lang.Object
  extended by edu.tum.cs.commons.string.RegexReplacement
All Implemented Interfaces:
IRegexReplacement

public class RegexReplacement
extends java.lang.Object
implements IRegexReplacement

Default implementation of IRegexReplacement.

Version:
$Rev: 26283 $
Author:
Florian Deissenboeck, $Author: juergens $
Rating:
GREEN Hash: 09EE4C50B63A33A746B17374B444B592

Constructor Summary
RegexReplacement(java.lang.String regex)
          Create a new regex replacement that does not replace the pattern matches by another string but deletes them.
RegexReplacement(java.lang.String regex, java.lang.String replacement)
          Create a new regex replacement.
 
Method Summary
 java.util.regex.Pattern getPattern()
          The pattern to match.
 java.lang.String getReplacement()
          The replacement for the pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexReplacement

public RegexReplacement(java.lang.String regex,
                        java.lang.String replacement)
                 throws java.util.regex.PatternSyntaxException
Create a new regex replacement. Syntax for patterns and replacements is specified in the API documentation of Pattern and Matcher.

Throws:
java.util.regex.PatternSyntaxException - if the pattern has a syntax error

RegexReplacement

public RegexReplacement(java.lang.String regex)
                 throws java.util.regex.PatternSyntaxException
Create a new regex replacement that does not replace the pattern matches by another string but deletes them. Syntax for patterns is specified in the API documentation of Pattern.

Throws:
java.util.regex.PatternSyntaxException - if the pattern has a syntax error
Method Detail

getPattern

public java.util.regex.Pattern getPattern()
The pattern to match.

Specified by:
getPattern in interface IRegexReplacement

getReplacement

public java.lang.String getReplacement()
The replacement for the pattern. The empty string may be used to define a deletion.

Specified by:
getReplacement in interface IRegexReplacement

TUM CCSM Commons

TUM CCSM Commons - 2.7