public class PatternReplaceCharFilter extends BaseCharFilter
ex1) source="aa bb aa bb", pattern="(aa)\\s+(bb)" replacement="$1#$2"
output="aa#bb aa#bb"
ex2) source="aa123bb", pattern="(aa)\\d+(bb)" replacement="$1 $2"
output="aa bb"
and you want to search bb and highlight it, you will get
highlight snippet="aa1<em>23bb</em>"
| Modifier and Type | Field and Description |
|---|---|
private java.util.regex.Pattern |
pattern |
private java.lang.String |
replacement |
private java.io.Reader |
transformedInput |
input| Constructor and Description |
|---|
PatternReplaceCharFilter(java.util.regex.Pattern pattern,
java.lang.String replacement,
java.io.Reader in) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
correct(int currentOff)
Retrieve the corrected offset.
|
private void |
fill() |
(package private) java.lang.CharSequence |
processPattern(java.lang.CharSequence input)
Replace pattern in input and mark correction offsets.
|
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
addOffCorrectMap, getLastCumulativeDiffclose, correctOffsetprivate final java.util.regex.Pattern pattern
private final java.lang.String replacement
private java.io.Reader transformedInput
public PatternReplaceCharFilter(java.util.regex.Pattern pattern,
java.lang.String replacement,
java.io.Reader in)
public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionprivate void fill()
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionprotected int correct(int currentOff)
BaseCharFiltercorrect in class BaseCharFiltercurrentOff - current offsetjava.lang.CharSequence processPattern(java.lang.CharSequence input)