public final class PatternReplaceFilter extends TokenFilter
Note: Depending on the input and the pattern used and the input TokenStream, this TokenFilter may produce Tokens whose text is the empty string.
Pattern
AttributeSource.State
input
DEFAULT_TOKEN_ATTRIBUTE_FACTORY
Constructor and Description |
---|
PatternReplaceFilter(TokenStream in,
Pattern p,
String replacement,
boolean all)
Constructs an instance to replace either the first, or all occurrences
|
Modifier and Type | Method and Description |
---|---|
boolean |
incrementToken() |
close, end, reset
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
public PatternReplaceFilter(TokenStream in, Pattern p, String replacement, boolean all)
in
- the TokenStream to processp
- the patterm to apply to each Tokenreplacement
- the "replacement string" to substitute, if null a
blank string will be used. Note that this is not the literal
string that will be used, '$' and '\' have special meaning.all
- if true, all matches will be replaced otherwise just the first match.Matcher.quoteReplacement(java.lang.String)
public boolean incrementToken() throws IOException
incrementToken
in class TokenStream
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.