public final class PatternReplaceFilter
extends org.apache.lucene.analysis.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
Modifier and Type | Field and Description |
---|---|
private boolean |
all |
private java.util.regex.Matcher |
m |
private java.util.regex.Pattern |
p |
private java.lang.String |
replacement |
private org.apache.lucene.analysis.tokenattributes.CharTermAttribute |
termAtt |
Constructor and Description |
---|
PatternReplaceFilter(org.apache.lucene.analysis.TokenStream in,
java.util.regex.Pattern p,
java.lang.String replacement,
boolean all)
Constructs an instance to replace either the first, or all occurances
|
Modifier and Type | Method and Description |
---|---|
boolean |
incrementToken() |
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString
private final java.util.regex.Pattern p
private final java.lang.String replacement
private final boolean all
private final org.apache.lucene.analysis.tokenattributes.CharTermAttribute termAtt
private final java.util.regex.Matcher m
public PatternReplaceFilter(org.apache.lucene.analysis.TokenStream in, java.util.regex.Pattern p, java.lang.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)