public class RegexReplacementRule extends AbstractRegexReplacementRule
Original code written by Tom White under the Apache v2 license. Modified by Philip R. Burns for integration into MorphAdorner.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
replacement |
pattern
Constructor and Description |
---|
RegexReplacementRule(java.lang.String regex,
java.lang.String replacement)
Construct a rule using the given regular expression and replacement string.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
replace(java.util.regex.Matcher matcher)
Use the state in the given
Matcher to perform a replacement. |
applies, apply, disjunction, disjunction
public RegexReplacementRule(java.lang.String regex, java.lang.String replacement)
regex
- The regular expression used to match words.replacement
- The replacement string.
The replacement string may contain references to subsequences
captured matching. See Matcher.appendReplacement(java.lang.StringBuffer, java.lang.String)
.
public java.lang.String replace(java.util.regex.Matcher matcher)
AbstractRegexReplacementRule
Matcher
to perform a replacement.replace
in class AbstractRegexReplacementRule
matcher
- The matcher used to match the word.